Variable is doing weird things
#1

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


Messages In This Thread
Variable is doing weird things - by Riwerry - 03.03.2016, 14:10
Re: Variable is doing weird things - by xEF - 04.03.2016, 10:34

Forum Jump:


Users browsing this thread: 1 Guest(s)