CheckDerby gets called twice.
#1

I am still on the process creating the 11th game for X Games Series, the Derby!

I am having some problems with the CheckDerby.
Information about CheckDerby: It is used to detect if the player has fallen out of the arena by checking the Z height.

I have tried making a bool variable and set it to true if a winner is declared, so in that way the next time CheckDerby is called in, it will be blocked in by the code i placed in (returning 1 instead). However this didn't worked. The timer is set to be called for 3500 mileseconds. This callback gets called twice or thrice.. Help me out bruh.

PHP код:
forward CheckDerby();
public 
CheckDerby()
{
    new 
string[150];
    if(
derby_time == false) return 1;
    if(
winner_derby == true) return 1;
    foreach(
derbyplayerid)
    {
        new 
Float:_pos[3];
        
GetPlayerPos(playerid_pos[0], _pos[1], _pos[2]);
        switch(
mode)
        {
            case 
DB_ID:
            {
                if(
_pos[2] <= 10)
                {
                    if(
OnDerby[playerid] == true)
                    {
                        
format(stringsizeof string"Eliminated:"white" %s has lost the derby [Fall out of Arena] (%d position)"GetName(playerid), Iter_Count(derby));
                        
SendClientMessageToAll(COLOR_REDstring);
                        
Iter_Remove(derbyplayerid);
                        new 
specplayer Iter_Random(derby);
                        
StartSpectate(playeridspecplayer);
                        
OnDerby[playerid] = false;
                    }
                    if (
Iter_Count(derby) == 1)
                    {
                        foreach(
derbyx)
                        {
                            
format(stringsizeof string"Winner:"white" %s has won the Derby, they won 5+ scores, 4 cakes and $2500"GetName(x));
                            
SendClientMessageToAll(COLOR_GREENstring);
                            
SetPlayerScore(xGetPlayerScore(x) + 5);
                            
GivePlayerCash(x2500);
                            
GiveCake(x4);
                            
User[x][accountDerby] ++;
                            
winner_derby true;
                            
SetTimer("ProcessEnding"3500false);
                            
KillTimer(timer);
                            
KillTimer(timer2);
                        }
                    }
                }
            }
        }
    }
    return 
1;

Reply


Messages In This Thread
CheckDerby gets called twice. - by JaKe Elite - 02.11.2015, 09:07
Re: CheckDerby gets called twice. - by JaKe Elite - 02.11.2015, 20:38
Re: CheckDerby gets called twice. - by Jefff - 02.11.2015, 20:54

Forum Jump:


Users browsing this thread: 1 Guest(s)