Ok, thats it, my eyes are like footballs after trying to find the reason of a bug in my script. A lot of stuff is going on and working, except for keeping track of returning players.
When a player triggers a goal model his authid is saved in the array finishContainer in function goal_touch.
When someone is connecting a client_authorized loops through finishContainer to see if the player reconnected.
Its a random error, sometimes it works, and sometimes not.
finishContainer is a global array defined
Code:
new finishContainer[maxUserid][32]
The authid is saved in function goal_touch
Code:
finishContainer[curId] = authid
And the loop in
Code:
// Check if its the first time before a map change a player connects
// and if the player has already triggered the goal.
public client_authorized(id) {
new authid[32]
get_user_authid(id,authid,31)
// Loop through the array of id's
new reconnected = 0
// Check if a player who finished is coming back
for (new loopId = 0; loopId < curId ; loopId++) {
if (equali(finishContainer[loopId],authid) != -1) {
set_task(30.0, "msgToReconnect",id)
reconnected = 1
hasFinished[id] = true
}
}
if (reconnected == 0)
set_task(30.0, "msgToNewPlayer",id)
return PLUGIN_CONTINUE
}
If the authid is stored in finishContainer it calls msgToReconnect, which shows a welcome back message. But, it do it with new players to sometimes. In these cases finishContainer[loopId] = 0.
How can finishContainer[loopId] which is 0 be equal to authid
which clearly contains the authid?
Am I doing something wrong returning the array content from goal_touch?
I would really appreciate help with this problem. Its one of the last parts before cleaning it up and releasing it.
Thx
/Lt