SA-MP Forums Archive
Weather Timer? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Weather Timer? (/showthread.php?tid=188390)



Weather Timer? - Luis- - 07.11.2010

Okay I have a weather timer here and it does not send the Message..

pawn Код:
forward Weather(playerid, reason);
public Weather(playerid, reason)
{
    SetWeather(random(10));
    switch(reason)
    {
        case 1:
        {
            SendClientMessage(playerid, COLOR_ORANGERED, "[WEATHER] Sunny with a chance of a slight breeze");
        }
        case 2:
        {
            SendClientMessage(playerid, COLOR_ORANGERED, "[WEATHER] Cloudy with alot of wind");
        }
    }
    return 1;
}



Re: Weather Timer? - Ivica_Razor - 07.11.2010

Maybe you forgot something, I'll make you a new one, just follow the tutorial!
1. add
Код:
forward RandomWeather();
2. search "enum pinfo" and then add:
Код:
enum weather_info
{
	wt_id,
	wt_text[255]
};

new gRandomWeatherIDs[][weather_info] =
{
	{1,"Plavo nebo"},
	{2,"Plavo nebo"},
	{3,"Plavo nebo"},
	{7,"Plavo nebo"},
	{8,"Oluja"},
	{9,"Hladno i maglovito"},
	{10,"Čisto Plavo nebo"},
 	{11,"Vrućina"},
	{12,"Normalno,Suncano"},
	{16,"Kiљovito"}
};
3. go on "ongamemodeinit" and add
Код:
SetTimer("RandomWeather", 600000, 1);
4. go on at the end of Scripts and add
Код:
public RandomWeather()
{
	new rand = random(sizeof(gRandomWeatherIDs));
	new strout[256];
	format(strout, sizeof(strout), "Vremenska prognoza: Vrijeme ce biti %s", gRandomWeatherIDs[rand][wt_text]);
	SetWeather(gRandomWeatherIDs[rand][wt_id]);
	SendClientMessageToAll(COLOR_LIGHTGREEN,strout);
	print(strout);
}
This code is on croatian language,easily translate If there is something not good to say.
SORRY FOR MY BAD ENGLISH!


Re: Weather Timer? - gr56 - 07.11.2010

Show your timer command
Propably you use SetTimer so reason = 0


Re: Weather Timer? - Luis- - 07.11.2010

Quote:
Originally Posted by gr56
Посмотреть сообщение
Show your timer command
Propably you use SetTimer so reason = 0
The tierm works it changes the weather but the Message don't show :/


Re: Weather Timer? - TouR - 07.11.2010

Код:
forward Weather(playerid, reason);
public Weather(playerid, reason)
{
    new weather = random(10);
    SetWeather(weather);
    switch(weather)
    {
        case 1:
        {
            SendClientMessage(playerid, COLOR_ORANGERED, "[WEATHER] Sunny with a chance of a slight breeze");
        }
        case 2:
        {
            SendClientMessage(playerid, COLOR_ORANGERED, "[WEATHER] Cloudy with alot of wind");
        }
    }
    return 1;
}
Try this