Small Weather system not working. - 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: Small Weather system not working. (
/showthread.php?tid=616664)
Small Weather system not working. -
kelvinis - 08.09.2016
Hello, i tried to make a automatic weather system that change the weather for everyone.
Код:
WeatherOnPlayerConnect(playerid) {
SetTimerEx("RandomWeather", 12000, false, "i", playerid);
}
forward RandomWeather();
public RandomWeather()
{
new weather;
weather = random(20);
foreach(Player, i) {
SetPlayerWeather(i,weather);
}
}
This should change every 12 seconds (Testing, will change it later), But it's actually not working at all.
Don't worry the "WeatherOnPlayerConnect" is defined in OnPlayerConnect.
Код:
public OnPlayerConnect(playerid) {
WeatherOnPlayerConnect(playerid);
return 0;
}
Can somebody give me some tips and help me out?
Re: Small Weather system not working. -
vassilis - 08.09.2016
On Timer you are using false which means that it will not be repeated. I guess you know that.
Also why you return 0; OnPlayerConnect?
2: You don't return any value on a public callback.
3: Change it and put it under OnGameModeInit (Sickattack mentioned it!)
Re: Small Weather system not working. -
SickAttack - 08.09.2016
Use a global timer that repeats. Put it under OnGameModeInit.
Re: Small Weather system not working. -
kelvinis - 08.09.2016
It's working now the problem was the 'false' forgot to change that
Thanks for the quick respond
Re: Small Weather system not working. -
Threshold - 08.09.2016
There are so many things wrong here, and you're not listening.
If you're going to use a loop in your timer, you should be using a GLOBAL timer, not a PER-PLAYER timer. Aka SetTimer, not SetTimerEx.