12.06.2014, 10:58
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;
}