Variable is doing weird things - 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 is doing weird things (
/showthread.php?tid=602171)
Variable is doing weird things -
Riwerry - 03.03.2016
Hello there, I have weird issue, its little bit complicated, but I will try my best to explain.
So I have variable from enum:
pawn Код:
new gAccountInfo[playerid][E_ACCOUNT_STATE]
//To make things easier for me I have some defines:
#define STATE_LOGGED_IN 1
#define STATE_SPAWNED 2
In onplayerconnect I reset whole enum for playerid, to be sure I also printed it and its really 0!
Then I have one SELECTABLE texdraw, which is clickable - its used to pop up login dialog and if is player logged I will spawn player, this check is doing the variable I was explaining.
So I click button and login dialog pops up I successfuly log in and I do after login
pawn Код:
gAccountInfo[playerid][E_ACCOUNT_STATE] = STATE_LOGGED_IN;
Dialog closes I click button again and I do check:
if(gAccountInfo[playerid][E_ACCOUNT_STATE] == STATE_LOGGED_IN) and afterwards I set state to spawned
And im spawned, so wheres my issue? Issue is when i restart server few times my login dialog opens one more
time after sucess login. I debugged and for some reason account state was spawned but i didnt set it yet. The fun is that state onplayerconnect is always set to 0.
Re: Variable is doing weird things -
xEF - 04.03.2016
I made some suppositions, but i still fully doesn't know what you mean, so i don't answer if i don't know as well.
If you can explain more clearly maybe i can help.
Regards.