11MSync = MSync or {}
22MSync .net = MSync .net or {}
33
4+ --[[
5+ Description: Function to send a table to the client
6+ Arguments:
7+ player [player] - the player to send the table to
8+ identifier [string] - what kind of table you are sending to the client
9+ table [table] - the table you send
10+ Returns: nothing
11+ ]]
412function MSync .net .sendTable (ply , identifier , table )
5- identifier = identifier or " settings"
13+ local identifier = identifier or " settings"
614
715 net .Start (" msync.sendTable" )
816 net .WriteString (identifier )
@@ -11,8 +19,16 @@ function MSync.net.sendTable(ply, identifier, table)
1119
1220end
1321
22+ --[[
23+ Description: Function to send a text message to the client
24+ Arguments:
25+ player [player] - the player you want to send the message to
26+ state [string] - the state of the message, can be "info", "error", "advert"
27+ message [string] - the message you want to send to the client
28+ Returns: nothing
29+ ]]
1430function MSync .net .sendMessage (ply , state , string )
15- state = state or " info"
31+ local state = state or " info"
1632
1733 net .Start (" msync.sendMessage" )
1834 net .WriteString (state )
@@ -21,26 +37,42 @@ function MSync.net.sendMessage(ply, state, string)
2137
2238end
2339
40+ --[[
41+ Description: Net Receiver - Gets called when the client requests a table
42+ Returns: nothing
43+ ]]
2444net .Receive (" msync.getTable" , function (len , ply )
2545 if not ply :query (" msync.getTable" ) then return end
2646
2747 local identifier = net .ReadString ()
2848 MSync .net .sendTable (ply , identifier , MSync [identifier ])
2949end )
3050
51+ --[[
52+ Description: Net Receiver - Gets called when the client sends the settings table to the server
53+ Returns: nothing
54+ ]]
3155net .Receive (" msync.sendSettings" , function (len , ply )
3256 if not ply :query (" msync.sendSettings" ) then return end
3357
3458 MSync .settings .data = net .ReadTable ()
3559 MSync .function .saveSettings ()
3660end )
3761
62+ --[[
63+ Description: Net Receiver - Gets called when the client requests the settings table
64+ Returns: nothing
65+ ]]
3866net .Receive (" msync.getSettings" , function (len , ply )
3967 if not ply :query (" msync.getSettings" ) then return end
4068
4169 MSync .net .sendTable (ply , " settings" , MSync .function .getSafeSettings ())
4270end )
4371
72+ --[[
73+ Description: Net Receiver - Gets called when the client requests the module table
74+ Returns: nothing
75+ ]]
4476net .Receive (" msync.getModules" , function (len , ply )
4577 if not ply :query (" msync.getModules" ) then return end
4678
0 commit comments