Posts: 104
Threads: 36
Joined: Feb 2017
Reputation:
0
Hi guys, I was looking for an answer but I sadly couldn't have found it. I was asking if the sizeof(.) function uses CPU while server is on or is it just processed in Precompiling process. Also what about INI saving, can I save certain variable at once without having to save every player's stat which causes way more lag for the server?
Posts: 1,076
Threads: 70
Joined: Jul 2016
Reputation:
0
sizeof is a compiler directive (not a function, thus you can omit the braces too), it's processed at compile time, whether you use hard-coded numbers or sizeof has no effect on your server's performance, let's just not get crazy with array sizes, okay?
Posts: 104
Threads: 36
Joined: Feb 2017
Reputation:
0
Alright, thanks for answer, what about last question?
Posts: 104
Threads: 36
Joined: Feb 2017
Reputation:
0
For example, I have a stock function which contains over 50 INI_Write. Right.
So, I use it many times after a player buys something, etc, so I was wondering if I could use INI_Write for only variables that need to be saved at that moment? Would the files stay the same way they were supposed to be if I used the stock for saving or would it miss many data that was supposed to be saved?
Posts: 1,076
Threads: 70
Joined: Jul 2016
Reputation:
0
I don't see why you would saving information at specific moments aside from updating password or something that's related to security, it would be fine to save all the data when the player disconnects, or maybe, set a timer that sets all player's stats every X minutes or so.
Posts: 41
Threads: 9
Joined: Apr 2017
Reputation:
0
You can check if the variables were changed and only save those variables.
And FYI sizeof is a special miscellaneous operator. Not a function.
Posts: 104
Threads: 36
Joined: Feb 2017
Reputation:
0
Thanks all. I guess I will stay at this moment with a stock function.