SetTimer
#1

hey guys. im a little noob in using settimer idk why i made a fucking simple drug command but idk how to set a timer for it...could somebody help?
Код:
	COMMAND:acid(playerid, params[])
	{
	    SetPlayerWeather(playerid,90);
     	SetTimer("NormalWeather",40000,false);
	    SetPlayerDrunkLevel(playerid, 3000);
	    SetPlayerTime(playerid, 7, 00);
	    SendClientMessage(playerid,0x43EE11FF,"You are on the effects of ACID drug now! Drink /coffee to stop hallucinating!");
		return 1;
	}
P.S.i searched but i didnt find any good result...
Reply
#2

Then forward NormalWeather and write public for NormalWeather.
pawn Код:
forward NormalWeather();
public NormalWeather()
{

}
Reply
#3

pawn Код:
COMMAND:acid(playerid, params[])
{
    SetPlayerWeather(playerid,90);
    //You will need SetTimerEx if you want to make change for the same
    //player that typed /acid.
    SetTimerEx("NormalWeather",40000,false,"i",playerid);
    //Else if you want to make change for all
    //use SetTimer("NormalWeather",40000,false);
    SetPlayerDrunkLevel(playerid, 3000);
    SetPlayerTime(playerid, 7, 00);
    SendClientMessage(playerid,0x43EE11FF,"You are on the effects of ACID drug now! Drink /coffee to stop hallucinating!");
    return 1;
}

forward NormalWeather(playerid);//If you are using SetTimerEx
//Else forward NormalWeather();

public NormalWeather(playerid)//public NormalWeather() if used SetTimer
{
    //Your code
    return 1;
}
Reply
#4

The post above is correct, however if you are going to use SetTimerEx like that, your server is going to get bugged. Thats why you need to assign timers id into a players variable and then kill the timer on player disconnect.
Reply
#5

thx for help guys fixed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)