setweather for only the player who chooses it.
#1

Hi there,

How to make it that when u set the weather in my dialog, it only sets the weather for that person and not the whole server?

Dialog:

pawn Код:
Dialog_VipWeather(playerid, response, listitem)
{
    // Just close the dialog if the player clicked "Cancel"
    if(!response) return 1;

    // Setup local variables
    new WeatherID;

    // Select the weather
    switch (listitem)
    {
        case 0: WeatherID = 0; // Normal
        case 1: WeatherID = 8; // Stormy
        case 2: WeatherID = 9; // Foggy
        case 3: WeatherID = 11; // Scorching hot
        case 4: WeatherID = 16; // Dull, cloudy, rainy
        case 5: WeatherID = 19; // Sandstorm
        case 6: WeatherID = 20; // Green Fog
        case 7: WeatherID = 33; // Dark, cloudy, brown
        case 8: WeatherID = 39; // Extremely bright
        case 9: WeatherID = 43; // Dark toxic clouds
        case 10: WeatherID = 44; // Black & white sky
    }

    // Set the weather
    SetWeather(WeatherID); // this sets it for whole server but how to make it only for player?
    // Inform the player about it
    SendClientMessage(playerid, 0xFFFFFFFF, "You have changed the weather!");

    return 1;
}
My vipweather command:

pawn Код:
COMMAND:vipweather(playerid, params[])
{
    // Send the command to all admins so they can see it
    SendAdminText(playerid, "/vipweather", params);

    // Check if the player has logged in
    if (APlayerData[playerid][LoggedIn] == true)
    {
        // Check if the player is vip
        if (APlayerData[playerid][PlayerLevel] >= 1)
        {
            // Let the player select a weather-type
            ShowPlayerDialog(playerid, DialogVipWeather, DIALOG_STYLE_LIST, "Select weather type:", "Normal\nStormy\nFoggy\nScorching Hot\nDull, cloudy, rainy\nSandstorm\nGreen Fog\nDark, cloudy, brown\nExtremely bright\nDark toxic clouds\nBlack & white sky", "Select", "Cancel");
        }
        else
            return 0;
    }
    else
        return 0;

    // Let the server know that this was a valid command
    return 1;
}
Reply
#2

https://sampwiki.blast.hk/wiki/SetPlayerWeather
Reply
#3

pawn Код:
SetPlayerWeather
****** is your friend.


EDIT: Damn, nice ninja Gazmull
Reply
#4

Thanks worked, couldn't find it so asked some fast help.

Thanks.
Reply
#5

Quote:
Originally Posted by SomebodyAndMe
Посмотреть сообщение
Thanks worked, couldn't find it so asked some fast help.

Thanks.
Next time, if you can't find a solution, always read your signature
Reply
#6

Quote:
Originally Posted by SomebodyAndMe
Посмотреть сообщение
Thanks worked, couldn't find it so asked some fast help.

Thanks.
Have you read the rules, sir? https://sampforum.blast.hk/showthread.php?tid=45235

Quote:
c) Help yourself
-Follow the READ ME FIRST! thread
-Use the search option
-Read the wiki

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)