SA-MP Forums Archive
Problem with something - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with something (/showthread.php?tid=250789)



Problem with something - Unknown123 - 24.04.2011

The timer dont get killed
pawn Код:
forward FailsToLogin(playerid);
new LoginFailTimer[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    LoginFailTimer[playerid] = SetPlayerTimer(playerid, "FailsToLogin", 30000, false);
    return 1;
}

public OnPlayerLogin(playerid)
{
    KillTimer(LoginFailTimer[playerid]);
    return 1;
}

public FailsToLogin(playerid)
{
    Kick(playerid);
    return 1;
}

stock SetPlayerTimer(playerid, funcname[], interval, bool:repeating)
{
    SetTimerEx(funcname, interval, repeating, "i", playerid);
}



Re: Problem with something - Sascha - 24.04.2011

are you sure the "OnPlayerLogin" even gets called?
try a debug function ("print("OnPlayerLogin called");" at OnPlayerLogin)


Re: Problem with something - Unknown123 - 24.04.2011

Fixed!

I just had ot change>
pawn Код:
stock SetPlayerTimer(playerid, funcname[], interval, bool:repeating)
{
    SetTimerEx(funcname, interval, repeating, "i", playerid);
}
to
pawn Код:
stock SetPlayerTimer(playerid, funcname[], interval, bool:repeating)
{
    return SetTimerEx(funcname, interval, repeating, "i", playerid);
}