Please answer someone my question
#1

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

KillTimer will stop a timer from repeating or continuing.
Reply
#3

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? 
Reply
#4

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;
Reply
#5

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
Reply
#6

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;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)