Does the server null's the values of enums autmaticaly - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Does the server null's the values of enums autmaticaly (
/showthread.php?tid=206857)
Does the server null's the values of enums autmaticaly -
Universal - 04.01.2011
So, i wanted to ask if server nulls the values of enums datas automaticaly when a player disconnects or i should do this by myself?
Re: Does the server null's the values of enums autmaticaly -
__ - 04.01.2011
I believe you mean reset, but yes, you need to reset the values yourself.
PVars reset when a player disconnects though.
Re: Does the server null's the values of enums autmaticaly -
Kwarde - 04.01.2011
Yes it's always '0' or 'false' standard.
(false if it's a bool, 0 if it's a string).
I mean, if you don't give it a value, it hasn't got a value yet. You know that? And '0' is nothing
Very basic told but true
EDIT:
Didn't read it good enough, sorry. You said 'when player disconnets'
Like already told, you have to do it yourself!
See it like this:
You have an 'Money[MAX_PLAYERS]' that stores the players money into a string. The max length of the array of the 'Money' is MAX_PLAYERS (standard 500). When someone with ID 3 has 5 dollar, the 'Money' in range '3' is '5'.
When a player disconnects, the array will still exist! So when someone connects with ID 3, he'll have '5' into the 'Money', array '3'. Got it?
Re: Does the server null's the values of enums autmaticaly -
Universal - 04.01.2011
Quote:
Originally Posted by Kwarde
Yes it's always '0' or 'false' standard.
(false if it's a bool, 0 if it's a string).
I mean, if you don't give it a value, it hasn't got a value yet. You know that? And '0' is nothing
Very basic told but true
EDIT:
Didn't read it good enough, sorry. You said 'when player disconnets'
Like already told, you have to do it yourself!
See it like this:
You have an 'Money[MAX_PLAYERS]' that stores the players money into a string. The max length of the array of the 'Money' is MAX_PLAYERS (standard 500). When someone with ID 3 has 5 dollar, the 'Money' in range '3' is '5'.
When a player disconnects, the array will still exist! So when someone connects with ID 3, he'll have '5' into the 'Money', array '3'. Got it?
|
Yes yes, thank you! That explains the bugs in my server. LOL. Good that i thought to ask about that...