SA-MP Forums Archive
Timer problem? - 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: Timer problem? (/showthread.php?tid=227680)



Timer problem? - farris - 18.02.2011

Hey guys i have a timer under onplayerconnect for payday but the timer gives pay every 10 minutes when it should be an hour Here it is...
Quote:

SetTimerEx("payday", 7200000, true, "d", playerid);

Quote:

public payday(playerid)
{
if(IsPoliceFaction(PlayerInfo[playerid][pFaction]))
{
GivePlayerMoney(playerid,30000);
SendClientMessage(playerid,COLOR_BLUE,"[PAYDAY]-[LEO CHECK]-[$25000]");
}
else if(IsGangFaction(PlayerInfo[playerid][pFaction]))
{
GivePlayerMoney(playerid,45000);
SendClientMessage(playerid,COLOR_GREEN,"[PAYDAY]-[CRIMINAL CHECK]-[$45000]");
}
else if(PlayerInfo[playerid][pFaction] > 4 && PlayerInfo[playerid][pFaction] < 6)
{
GivePlayerMoney(playerid,25000);
SendClientMessage(playerid,COLOR_RED,"[PAYDAY]-[EMERGENCY SERVICE CHECK]-[$25000]");
}
else if(PlayerInfo[playerid][pFaction] == 0)
{
GivePlayerMoney(playerid,5000);
SendClientMessage(playerid,COLOR_WHITE,"[PAYDAY]-[WELFARE CHECK]-[$5000]");
}
else if(PlayerInfo[playerid][pJob] == JOB_TOWER)
{
GivePlayerMoney(playerid,5000);
SendClientMessage(playerid,COLOR_ORANGE,"[PAYDAY]-[TOWING COMPANY]-[$12000]");
}
else if(PlayerInfo[playerid][pJob] == JOB_PROSTITUTE)
{
GivePlayerMoney(playerid,10000);
SendClientMessage(playerid,COLOR_LIGHTBLUE,"Someon e just gave you a check for 10000 and said be ready at 9");
}
}

ALSO when i alt tab for like 5 minutes i get 4 pay checks


Re: Timer problem? - JaTochNietDan - 18.02.2011

Are you killing the timer when the player disconnects? Otherwise the timer will run constantly and timers will just continue stacking per player that connects, you may end up having hundreds of timers for each person if you're not killing them.


Re: Timer problem? - farris - 18.02.2011

ill try that now