SA-MP Forums Archive
When they smoke? - 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)
+--- Thread: When they smoke? (/showthread.php?tid=330489)



When they smoke? - BleverCastard - 01.04.2012

Hello,

When a player smokes 'weed' I want them to go to Weather ID 100 for like 5 seconds.
How would I make this happen
Code:
CMD:smokeweed(playerid, params[])
{
	if(playerVariables[playerid][pWeed] > 1)
	{

	}
}



Re: When they smoke? - Jonny5 - 01.04.2012

you can try this

im not sure if the timers will work like this but if it does it makes it easy
pawn Code:
CMD:smokeweed(playerid, params[])
{
    if(playerVariables[playerid][pWeed] > 1)
    {
        SetPlayerWeather(playerid, 100);
        SetTimerEx("SetPlayerWeather", 5000, false, "ii", playerid, 0);
    }
}
EDIT:after looking below I made a change


Re: When they smoke? - Catalyst- - 01.04.2012

Code:
CMD:smokeweed(playerid, params[])
{
    if(playerVariables[playerid][pWeed] > 1)
    {
        SetPlayerWeather(playerid, 100);
        SetTimerEx("ResetWeather", 5000, false, "i", playerid);
    }
}

forward ResetWeather(playerid);
public ResetWeather(playerid)
{
	SetPlayerWeather(playerid, 0);
	return 0;
}