Posts: 191
Threads: 34
Joined: Apr 2012
Reputation:
0
Well I found out that many servers use enum PlayerInfowhen they set money/weapons/whatever in commands and they convert the enum to dini/SQL or whatever they use on OnPlayerDisconnect. So I wonder why? Why can't you just set the variable directly from the saving system when you build commands and such instead of just saving it on OnPlayerDisconnect?
Will it cause laggs if I'll set the variable directly to my saving system at commands like /pay, /giveweapon and any other command which requires something to be saved?
Posts: 191
Threads: 34
Joined: Apr 2012
Reputation:
0
By the way I just gave dini and SQL as an examples, it might be INI or whatever you use.
Posts: 1,177
Threads: 27
Joined: Sep 2011
Reputation:
0
Yes it will lag and people will be able to exploit this to lag the server by spamming those commands, which will continue executing queries and stop your server from doing any actions until the queries are completed.
Posts: 191
Threads: 34
Joined: Apr 2012
Reputation:
0
And if let's say, I will just convert the enum variables to my saving system on OnPlayerDisconnect yes it won't lag but on the other hand, in case of server restart/server falldown/reback/whatever it won't save the variables of the saving system, will it?
Posts: 1,177
Threads: 27
Joined: Sep 2011
Reputation:
0
No it won't but you can add a command to save the user which could only be used every 5 minutes or so.
Posts: 191
Threads: 34
Joined: Apr 2012
Reputation:
0
Yeah I actually thought about creating a repetitive timer for saving function like every 10 minutes but it might lag the server if it has a lot of users online, right?