PDA

View Full Version : Weather


vent
22/11/2011, 11:05 AM
So, i have got an problem.
The weather wont change.

#define COLOR_LIGHTBLUE 0x33CCFFAA //värv
#define ilmaaeg 60000*3 //aeg

new Ilm;

forward Ilm();

public Ilm()
{

Ilm = random(20);
SetWeather(Ilm);
switch(Ilm)
{
case 0:SendClientMessageToAll(COLOR_LIGHTBLUE,"[Ilm] Päikseline");
case 1:SendClientMessageToAll(COLOR_LIGHTBLUE,"[Ilm] Päikseline");
case 2:SendClientMessageToAll(COLOR_LIGHTBLUE,"[Ilm] Päikseline");
case 3:SendClientMessageToAll(COLOR_LIGHTBLUE,"[Ilm] Päikseline");
case 4:SendClientMessageToAll(COLOR_LIGHTBLUE,"[Ilm] Päikseline");
case 5:SendClientMessageToAll(COLOR_LIGHTBLUE,"[Ilm] Päikseline");
case 7:SendClientMessageToAll(COLOR_LIGHTBLUE,"[Ilm] Päikseline");
case 8:SendClientMessageToAll(COLOR_LIGHTBLUE,"[Ilm] Vihmane");
case 9:SendClientMessageToAll(COLOR_LIGHTBLUE,"[Ilm] Paks udu");
case 10:SendClientMessageToAll(COLOR_LIGHTBLUE,"[Ilm] Päikseline");
case 11:SendClientMessageToAll(COLOR_LIGHTBLUE,"[Ilm] Kuumalaine");
case 12:SendClientMessageToAll(COLOR_LIGHTBLUE,"[Ilm] Palav ilm");
case 13:SendClientMessageToAll(COLOR_LIGHTBLUE,"[Ilm] Palav ilm");
case 14:SendClientMessageToAll(COLOR_LIGHTBLUE,"[Ilm] Palav ilm");
case 15:SendClientMessageToAll(COLOR_LIGHTBLUE,"[Ilm] Suur torm");
case 16:SendClientMessageToAll(COLOR_LIGHTBLUE,"[Ilm] Väga palav ilm");
case 17:SendClientMessageToAll(COLOR_LIGHTBLUE,"[Ilm] Väga palav ilm");
case 18:SendClientMessageToAll(COLOR_LIGHTBLUE,"[Ilm] Väga palav ilm");
case 19:SendClientMessageToAll(COLOR_LIGHTBLUE,"[Ilm] Liivatorm");
case 20:SendClientMessageToAll(COLOR_LIGHTBLUE,"[Ilm] ???");


}
}

JaTochNietDan
22/11/2011, 11:07 AM
Have you set a timer anywhere? You can't expect a callback to get called by itself :)

For example in OnGameModeInit:

SetTimer("Ilm", ilmaaeg, true);

Also I would suggest using an array to store the strings, then you wouldn't have to deal with that big long switch statement :)

vent
22/11/2011, 11:08 AM
Whoops, my bad. It works now. +rep for you. ;>