sizeof() or direct number in functions and INI saving question
#1

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

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

Alright, thanks for answer, what about last question?
Reply
#4

Quote:
Originally Posted by ElMaestro123
Посмотреть сообщение
Alright, thanks for answer, what about last question?
Sure, but can you be a little more explicit with your last question?
Reply
#5

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

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

Quote:
Originally Posted by ElMaestro123
Посмотреть сообщение
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?
You can make other stocks for the variables that need to be saved.
Reply
#8

You can check if the variables were changed and only save those variables.
And FYI sizeof is a special miscellaneous operator. Not a function.
Reply
#9

Thanks all. I guess I will stay at this moment with a stock function.
Reply
#10

Quote:
Originally Posted by Eoussama
Посмотреть сообщение
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?
Thank you for that attention.
You helped me too.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)