[HELP] weather
#1

I always want this on my gamemode but I don't know how to make this so let's go to explain.

Let's se I have for example timer for weather that set every one minute and then it print all players:

good day dear listeners
the current weather is: sunny
the weather for next minute is: windy

and one minute pass and it says:

good day dear listeners
current weather is: windy
the weather for next minute is: sunny

On example this which I wrote do you know what I mean? Thanks. I'm gonna be so happy if I can do this of course with your help? Thanks. And of course the code which set the current weather...
Reply
#2

Do you want the weather to change every minute or hour?

EDIT: here you go: http://pastebin.com/zSLeRZG3
Reply
#3

I want to be random not by a row and the one command to turn on or off weather? Thanks
Reply
#4

Quote:
Originally Posted by Luca12
Посмотреть сообщение
I want to be random not by a row and the one command to turn on or off weather? Thanks
Use switch and case then with a timer.
Reply
#5

this what he give me I want for all players on server to set weather and text not playerid?
Reply
#6

This should work for you:
pawn Код:
#include <a_samp>
#include <zcmd>

new WeatherTimer; //This is the timer that will be used for the weather.
new bool:WeatherDisabled; //Will determine whether the wheather (xD) is running or not.

public OnGameModeInit()
{
    WeatherDisabled = false;
    WeatherTimer = SetTimerEx("ChangeWeather", 60000, false, "i", random(20)); //First timer when the gamemode is started will be 1 minute long.
    SetWeather(1);
    return 1;
}

CMD:startweather(playerid, params[])
{
    //This will only be restricted to RCON Admins, change !IsPlayerAdmin with your own admin variables.
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "Only RCON Administrators can use this command.");
    if(WeatherDisabled == false) return SendClientMessage(playerid, 0xFF0000FF, "The weather is currently running. Use /stopweather to disable it.");
    WeatherDisabled = false;
    WeatherTimer = SetTimerEx("ChangeWeather", 1000, false, "i", random(20));
    return 1;
}

CMD:stopweather(playerid, params[])
{
    //This will only be restricted to RCON Admins, change !IsPlayerAdmin with your own admin variables.
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "Only RCON Administrators can use this command.");
    if(WeatherDisabled == true) return SendClientMessage(playerid, 0xFF0000FF, "The weather is not currently running. Use /startweather to enable it.");
    WeatherDisabled = true;
    SendClientMessageToAll(0xFFFF00FF, "The weather predictions have stopped, as weather is not expected to change any time soon.");
    KillTimer(WeatherTimer);
    return 1;
}

forward ChangeWeather(Weather);
public ChangeWeather(Weather)
{
    if(WeatherDisabled == true) return 1;
    new NextWeather = random(20);
    new Time = random(60);
    new str[125];
    format(str, sizeof(str), "Good Day listeners, the current weather is {00F0F0}%s{FFFF00}. The next weather prediction will be {00F0F0}%s.", GetWeatherName(Weather), GetWeatherName(NextWeather));
    SendClientMessageToAll(0xFFFF00FF, str);
    WeatherTimer = SetTimerEx("ChangeWeather", (60000 + (Time * 1000)), false, "i", NextWeather);
    return 1;
}

stock GetWeatherName(weatherid)
{
    new Weathername[12];
    switch(weatherid)
    {
        case 0, 6, 13, 17:      Weathername = "Very Sunny";
        case 1, 5, 10, 14, 18:  Weathername = "Sunny";
        case 4, 7, 12, 15:      Weathername = "Cloudy";
        case 8, 16:             Weathername = "Rainy";
        case 2, 3:              Weathername = "Smoggy";
        case 9, 20:             Weathername = "Foggy";
        case 11:                Weathername = "Heatwave";
        case 19:                Weathername = "Sandstorm";
    }
    return Weathername;
}
Reply
#7

Ok just one question how can I make example when is day then it says good day and when is the evening it say's good evening if you know what I mean? Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)