23.03.2013, 04:04
Hi, ive made it so when you smoke more than the choosen ammount (i put it on 2 for test) you get cancer. Now.. my problem is that i dont know if the player have cancer... This is the smoke code
and if the player have cancer this is supose to come
But it dont, i have been waiting longer than the timer is supose to be and still nothing
pawn Код:
if(strcmp(cmd, "/smoke", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pLighter] > 0)
{
if(PlayerInfo[playerid][pCigarettes] > 0)
{
IsSmoking[playerid] = 1;
PlayerInfo[playerid][pCigarettes] --;
PlayerInfo[playerid][pLighter] --;
if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), "* Stranger takes out his lighter and cigarette and lights it up."); }
else { format(string, sizeof(string), "* Stranger takes out her lighter and cigarette and lights it up."); }
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_SMOKE_CIGGY);
PlayerInfo[playerid][pTimesSmoked] ++;
if(PlayerInfo[playerid][pTimesSmoked] > 2)
{
PlayerInfo[playerid][pCancer] = 1;
}
if(PlayerInfo[playerid][pCancer])
{
new Float: HP;
GetPlayerHealth(playerid, HP);
SetPlayerHealth(playerid, HP-5);
}
}
else
{
SendClientMessage(playerid,COLOR_GREY,"You dont have any ciggarettes left,Go buy some more!");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You dont have a lighter!");
}
}
return 1;
}
pawn Код:
if(PlayerInfo[playerid][pCancer] == 1)
{
SendClientMessage(playerid, COLOR_BLUE, "You're having trouble breathing... (( Lung Cancer ))");
SetTimerEx("Cough", 6000, 1, "d", playerid);
}
return 1;
}
forward Cough(playerid);
public Cough(playerid)
{
if(PlayerInfo[playerid][pCancer] == 1)
{
new string[256];
format(string, sizeof(string), "%s is coughing really hard...", playerid);
ProxDetector(20.0, playerid, string,COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
new Float:HP;
GetPlayerHealth(playerid, HP);
SetPlayerHealth(playerid, HP-4);
}
}