SA-MP Forums Archive
Variable resetting after player disconnect... - 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)
+--- Thread: Variable resetting after player disconnect... (/showthread.php?tid=485496)



Variable resetting after player disconnect... - NeroX98 - 04.01.2014

Hi guys...

I have one question, should i use player variables like new PVARIABLE[MAX_PLAYERS] or this kind of variables https://sampwiki.blast.hk/wiki/SetPVarInt ?

I know that the variables like PVARIABLE[MAX_PLAYERS] are not resetting if the client crash, that kind of variables i'm resetting under OnPlayerDisconnect so if someone disconnects properly, his variables will return to 0, but if their sa-mp client crash the variables aren't resetting... So my final question is - Are this kind of variables ( https://sampwiki.blast.hk/wiki/SetPVarInt ) resetting automatically after player disconnects/crash ?


Re: Variable resetting after player disconnect... - Wizza - 04.01.2014

This was originally posted by the sa-mp wiki
Quote:

Note: Variables aren't reset until after OnPlayerDisconnect is called, so the values are still accessible in OnPlayerDisconnect.

The same wiki page you posted read next time will ya.


Re: Variable resetting after player disconnect... - Konstantinos - 04.01.2014

I do not recommend you to use PVars: https://sampforum.blast.hk/showthread.php?tid=268499

Variables (in your case the array) will be reset even if the player crashed. OnPlayerDisconnect is called so if you have:
pawn Код:
// OnPlayerDisconnect:
PVARIABLE[playerid] = 0;
it will be reset normally.


Re: Variable resetting after player disconnect... - NeroX98 - 04.01.2014

Quote:
Originally Posted by Wizza
Посмотреть сообщение
This was originally posted by the sa-mp wiki The same wiki page you posted read next time will ya.
Man... my question was if the player crashes...

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
I do not recommend you to use PVars: https://sampforum.blast.hk/showthread.php?tid=268499

Variables (in your case the array) will be reset even if the player crashed. OnPlayerDisconnect is called so if you have:
pawn Код:
// OnPlayerDisconnect:
PVARIABLE[playerid] = 0;
it will be reset normally.
TNX MAN... You really helped me to understand these things :P THANKS AGAIN... REP +