SA-MP Forums Archive
Please answer someone my question - 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: Please answer someone my question (/showthread.php?tid=272307)



I need help,and i need it fast - Pasa - 27.07.2011

if I use
KillTimer
will that stop repeatint or only will stop the time interval?


Re: Please answer someone my question - iPLEOMAX - 27.07.2011

KillTimer will stop a timer from repeating or continuing.


Re: Please answer someone my question - Pasa - 27.07.2011

it/s posible to make something like this


PHP код:
new pee;
forward peeing(playerid);
public 
peeing(playerid)
{
       
GivePlayerHealth(playerid,-50)
    return 
1;
}
forward warning(playerid);
public 
warning(playerid)
{
       
SendClientMessage(playerid,COLOR_RED,"You must pee for 5 minute!");
    return 
1;
}
    
public 
OnPlayerConnect(playerid)
{
    
SetTimer("warning",1500000,true)//now everi 25 min
    
pee SetTimer("peeing",1800000,true); //now every 30 min 
    
return 1;
}
if(
strcmp(cmd"/pee"true) == 0)
    {
        
KillTimer(pee)
        
SendClientMessage(playerid,COLOR_RED,"aaa thats feel good"); 
            
//here the animatiion for pee-ing
            
return 1;
    }
//but how to make that the timer repeate evre 30 min but when you use the /pee command that only stops the timer interval? 



Re: Please answer someone my question - AndreT - 27.07.2011

In that case you could use a variable which you toggle.
pawn Код:
new bool:skipThisTime;

forward Timer();
public Timer()
{
    if(skipThisTime == true)
    {
        skipThisTime = false;
        return true;
    }
}

// if you want to skip the next occurrence
skipThisTime = true;



Re: Please answer someone my question - Pasa - 27.07.2011

can you show me how can i use on my code?
when you use the cmd /pee than only skip te timer interval but it wil repeate


Re: Please answer someone my question - =WoR=Varth - 28.07.2011

pawn Код:
new pee[MAX_PLAYERS];

forward peeing(playerid);
public peeing(playerid)
{
    GivePlayerHealth(playerid,-50)
    pee[playerid] = SetTimerEx("warning",1500000,0)
    return 1;
}
forward warning(playerid);
public warning(playerid)
{
    SendClientMessage(playerid,COLOR_RED,"You must pee for 5 minute!"); //25 minutes
    pee[playerid] = SetTimerEx("peeing",300000,0,"d",playerid);//5 minutes
    return 1;
}
     
public OnPlayerConnect(playerid)
{
    pee[playerid] = SetTimerEx("warning",1500000,0)
    return 1;
}


if(strcmp(cmd, "/pee", true) == 0)
    {

        KillTimer(pee[playerid])
        pee[playerid] = SetTimerEx("warning",1500000,0,"d",playerid)
        SendClientMessage(playerid,COLOR_RED,"aaa thats feel good");  
        return 1;
    }