Saving system
#1

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?
Reply
#2

By the way I just gave dini and SQL as an examples, it might be INI or whatever you use.
Reply
#3

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.
Reply
#4

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?
Reply
#5

No it won't but you can add a command to save the user which could only be used every 5 minutes or so.
Reply
#6

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?
Reply
#7

Well?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)