Timer problem
#1

i Have problem with timer. i create settimer in onplayerentercheckpoint but timmer cannot execute this my code
PHP код:
forward bsampah(playerid);
forward csampah(playerid);
public 
bsampah(playerid)
{
    
TogglePlayerControllable(playerid1);
    
tsampah[playerid] = SetPlayerCheckpoint(playerid,2290.5510,-2117.1140,14.0950,3);
    
SendClientMessageEx(playeridCOLOR_LIGHTBLUE"* sampah berhasil di naikan. pergi ke penbuangan");
    
jsampah[playerid]=2;
    
}
public 
csampah(playerid)
{
    
GivePlayerMoney(playerid,2500);
    
SendClientMessageEx(playeridCOLOR_LIGHTBLUE"* sampah telah di buang");
    
SendClientMessageEx(playeridCOLOR_LIGHTBLUE"* Kamu mendapatkan $2500 dari membuang sampah");
    
jsampah[playerid]=0;
    
TogglePlayerControllable(playerid1);
    
DisablePlayerCheckpoint(playerid);
    
}
onplayercheckpoint
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 408)
    {
        if (
jsampah[playerid]==1)
        {
             
TogglePlayerControllable(playerid0);
             
SetTimer("bsampah"50000);
             
SendClientMessageEx(playeridCOLOR_LIGHTBLUE"* proses menaikan sampah");
             
SendClientMessageEx(playeridCOLOR_LIGHTBLUE"* proses............");
             
//tidebos
         
         
}
         if (
jsampah[playerid]==2)
        {
             
TogglePlayerControllable(playerid0);
             
SetTimer("csampah"50000);
             
SendClientMessageEx(playeridCOLOR_LIGHTBLUE"* proses munurunkan sampah");
             
SendClientMessageEx(playeridCOLOR_LIGHTBLUE"* proses............");
             
//tidebos
         
}
    } 
why time not execute?
Reply
#2

Change this
PHP код:
SetTimer("bsampah"50000); to
SetTimerEx
("bsampah"50000,"i",playerid); 
First. Why the timer can't execute with SetTimer !
>>Because the playerid is not certainly !!

So .. we must SetTimerEx(Callbacks,time,repeat,format,float);
So The callbacks can execute the certainly playerid..

Dont forget change the SetTimerEx "jsampah" too..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)