[Help] - ServerWeather
#1

I have one problem with seting PlayerWeather. When player uses ex. marihuana, his weaher sets to ID 250. When he finish using it, his weather should change to weather which server uses, but it's not.

pawn Код:
new ServerWeather;

forward Weather();
public Weather()
{
    new hours, minutes, seconds;
    new rand = random(5);
    new str[128];
    gettime(hours, minutes, seconds);
    if(minutes == 00)
    {
        if(rand == 1)
        {
            SetWeather(10);
            ServerWeather = 10;
            format(str, sizeof(str), "Felictas RolePlay: Now is %d:%d hours.", hours, minutes);
            scmta(color_white, str);
            scmta(color_green, "Weather forecast: "col_white"expected weather for next 60 minutes is "col_skyblue"sunny.");
        }
        else if(rand == 2)
        {
            SetWeather(4);
            ServerWeather = 4;
            format(str, sizeof(str), "Felictas RolePlay: Now is %d:%d hours.", hours, minutes);
            scmta(color_white, str);
            scmta(color_green, "Weather forecast: "col_white"expected weather for next 60 minutes is "col_skyblue"cloudy.");
        }
        else if(rand == 3)
        {
            SetWeather(16);
            ServerWeather = 16;
            format(str, sizeof(str), "Felictas RolePlay: Now is %d:%d hours.", hours, minutes);
            scmta(color_white, str);
            scmta(color_green, "Weather forecast: "col_white"expected weather for next 60 minutes is "col_skyblue"rainy.");
        }
        else if(rand == 4)
        {
            SetWeather(9);
            ServerWeather = 9;
            format(str, sizeof(str), "Felictas RolePlay: Now is %d:%d hours.", hours, minutes);
            scmta(color_white, str);
            scmta(color_green, "Weather forecast: "col_white"expected weather for next 60 minutes is "col_skyblue"foggy.");
        }
    }
    return 1;
}

//Koriљtenje heorina
forward HeroineEffect(playerid);
public HeroineEffect(playerid)
{
    new Float:health;
    GetPlayerHealth(playerid);
    if(DrugsEffectTimer[playerid] == 1)
    {
        DrugsEffectTimer[playerid] = 2;
        SetPlayerHealth(playerid, health+3);
        Drugs[playerid] = SetTimer("DrugsEffect", 2000, false);
    }
    else if(DrugsEffectTimer[playerid] == 2)
    {
        DrugsEffectTimer[playerid] = 3;
        SetPlayerHealth(playerid, health+3);
        Drugs[playerid] = SetTimer("DrugsEffect", 3000, false);
    }
    else if(DrugsEffectTimer[playerid] == 3)
    {
        DrugsEffectTimer[playerid] = 4;
        SetPlayerHealth(playerid, health+3);
        Drugs[playerid] = SetTimer("DrugsEffect", 4000, false);
    }
    else if(DrugsEffectTimer[playerid] == 4)
    {
        DrugsEffectTimer[playerid] = 5;
        SetPlayerHealth(playerid, health+3);
        Drugs[playerid] = SetTimer("DrugsEffect", 5000, false);
    }
    else if(DrugsEffectTimer[playerid] == 5)
    {
        DrugsEffectTimer[playerid] = 6;
        SetPlayerHealth(playerid, health+3);
        Drugs[playerid] = SetTimer("DrugsEffect", 5000, false);
    }
    else if(DrugsEffectTimer[playerid] == 6)
    {
        DrugsEffectTimer[playerid] = 7;
        SetPlayerHealth(playerid, health+3);
        Drugs[playerid] = SetTimer("DrugsEffect", 6000, false);
    }
    else if(DrugsEffectTimer[playerid] == 7)
    {
        DrugsEffectTimer[playerid] = 8;
        SetPlayerHealth(playerid, health+3);
        Drugs[playerid] = SetTimer("DrugsEffect", 7000, false);
    }
    else if(DrugsEffectTimer[playerid] == 8)
    {
        DrugsEffectTimer[playerid] = 9;
        SetPlayerHealth(playerid, health+3);
        Drugs[playerid] = SetTimer("DrugsEffect", 8000, false);
    }
    else if(DrugsEffectTimer[playerid] == 9)
    {
        DrugsEffectTimer[playerid] = 10;
        SetPlayerHealth(playerid, health+3);
        Drugs[playerid] = SetTimer("DrugsEffect", 9000, false);
    }
    else if(DrugsEffectTimer[playerid] == 10)
    {
        DrugsEffectTimer[playerid] = 11;
        SetPlayerHealth(playerid, health+3);
        Drugs[playerid] = SetTimer("DrugsEffect", 10000, false);
    }
    else if(DrugsEffectTimer[playerid] == 11)
    {
        SetPlayerHealth(playerid, health+3);
        SetPlayerWeather(playerid, ServerWeather);
        KillTimer(Drugs[playerid]);
    }
    return 1;
}

// Koriљtenje marihuane
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_FIRE)
    {
        if(SmokingMarihuana[playerid] == 1)
        {
            new Float:health;
            GetPlayerHealth(playerid, health);
            if(TimeSmoked[playerid] == 1)
            {
                TimeSmoked[playerid] = 2;
                SetPlayerHealth(playerid, health+3);
                SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
            }
            else if(TimeSmoked[playerid] == 2)
            {
                TimeSmoked[playerid] = 3;
                SetPlayerHealth(playerid, health+3);
                SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
            }
            else if(TimeSmoked[playerid] == 3)
            {
                TimeSmoked[playerid] = 4;
                SetPlayerHealth(playerid, health+3);
                SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
            }
            else if(TimeSmoked[playerid] == 4)
            {
                TimeSmoked[playerid] = 5;
                SetPlayerHealth(playerid, health+3);
                SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
            }
            else if(TimeSmoked[playerid] == 5)
            {
                TimeSmoked[playerid] = 6;
                SetPlayerHealth(playerid, health+3);
                SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
            }
            else if(TimeSmoked[playerid] == 7)
            {
                TimeSmoked[playerid] = 8;
                SetPlayerHealth(playerid, health+3);
                SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
            }
            else if(TimeSmoked[playerid] == 9)
            {
                TimeSmoked[playerid] = 10;
                SetPlayerHealth(playerid, health+3);
                SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
            }
            else if(TimeSmoked[playerid] == 10)
            {
                TimeSmoked[playerid] = 11;
                SetPlayerHealth(playerid, health+3);
                SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
            }
            else if(TimeSmoked[playerid] == 11)
            {
                TimeSmoked[playerid] = 12;
                SetPlayerHealth(playerid, health+3);
                SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
            }
            else if(TimeSmoked[playerid] == 12)
            {
                TimeSmoked[playerid] = 13;
                SetPlayerHealth(playerid, health+3);
                SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
            }
            else if(TimeSmoked[playerid] == 13)
            {
                TimeSmoked[playerid] = 14;
                SetPlayerHealth(playerid, health+3);
                SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
            }
            else if(TimeSmoked[playerid] == 14)
            {
                TimeSmoked[playerid] = 0;
                SmokingMarihuana[playerid] = 0;
                SetPlayerHealth(playerid, health+3);
                SetPlayerWeather(playerid, ServerWeather);
                SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
            }
        }
    }
        return 1;
}

public OnGameModeInit()
{
    SetTimer("Weather", 1000, true);
        ServerWeather = 10;
        return 1;
}
Reply
#2

There is no
Код:
SetPlayerWeather(playerid, 250);
in the script?
It just returns to 'ServerWeather'
Reply
#3

To make it simple, to detect if someone is stoned, just have a stock like IsPlayerStoned in the stock put the weather you want along with the timer again create a weather timer keep your desired time then under it Stoned[playerid] = 0 to notify player is not stoned and then to set his weather according to the servers SetPlayerWeather(playerid, ServerWeather);
Reply
#4

Quote:
Originally Posted by Cutt3r
Посмотреть сообщение
There is no
Код:
SetPlayerWeather(playerid, 250);
in the script?
It just returns to 'ServerWeather'
pawn Код:
YCMD:usedrugs(playerid, params[], help)
{
    new choose[10];
    if(sscanf(params, "s", choose)) return scm(playerid, color_red, "* "col_white"Command using: /usedrugs [Choose(marihuana/heroin/cocaine)]");
    if(strcmp(choose, "heroin", true) == 0)
    {
        if(PlayerInfo[playerid][pHeroine] == 10) return scm(playerid, color_red, "* "col_white"You don't have enough heroin.");
        if(PlayerInfo[playerid][pNeedle] == 0) return scm(playerid, color_red, "* "col_white"You don't have any needles.");
        {
            SetPlayerWeather(playerid, 100);
            DrugsEffectTimer[playerid] = 1;
            PlayerInfo[playerid][pNeedle] -= 1;
            SetPlayerDrunkLevel(playerid, 6000);
            PlayerInfo[playerid][pHeroine] -= 10;
            PlayerInfo[playerid][pHeroineAdd] += 1;
            Drugs[playerid] = SetTimer("HeroineEffect", 7500, false);
        }
    }
    else if(strcmp(choose, "marihuana", true) == 0)
    {
        if(RolledMarihuanaAmount[playerid] < 10) return scm(playerid, color_red, "* "col_white"You didn't rolled any marihuana.");
        if(SmokingMarihuana[playerid] == 1) return scm(playerid, color_red, "* "col_white"You're already smoking marihuana.");
        else
        {
            TimeSmoked[playerid] = 1;
            SmokingMarihuana[playerid] = 1;
            SetPlayerWeather(playerid, 250);
            SetPlayerDrunkLevel(playerid, 6000);
            RolledMarihuanaAmount[playerid] = 0;
            PlayerInfo[playerid][pMarihuanaAdd] += 1;
            SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
        }
    }
    return 1;
}
Reply
#5

ThreadUp
Reply
#6

ThreadUp
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)