Small Weather system not working.
#1

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

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!)
Reply
#3

Use a global timer that repeats. Put it under OnGameModeInit.
Reply
#4

It's working now the problem was the 'false' forgot to change that

Thanks for the quick respond
Reply
#5

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)