Player dont get cancer -
Don_Cage - 23.03.2013
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
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;
}
and if the player have cancer this is supose to come
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);
}
}
But it dont, i have been waiting longer than the timer is supose to be and still nothing
Re: Player dont get cancer -
PaulDinam - 23.03.2013
Where do you put this in your gamemode?
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;
}
Re: Player dont get cancer -
Don_Cage - 23.03.2013
OnPlayerSpawn
Re: Player dont get cancer -
PaulDinam - 23.03.2013

Is PlayerInfo[playerid][pCancer] saves in some kind of file or mysql?
Re: Player dont get cancer -
Don_Cage - 23.03.2013
Dammit.. Thanks forgot about that lol. Sorry,will make it save in file and come back with if it works or not
Re: Player dont get cancer -
PaulDinam - 23.03.2013
And one more thing in the timerex,
SetTimerEx("Cough", 6000, 1, "d", playerid);
1, change to 0.
or else it will keep calling the function
Re: Player dont get cancer -
Don_Cage - 23.03.2013
I want it to keep calling the function every 1 hour (6 seconds for test now) so shouldnt it be on 1 then?
Re: Player dont get cancer -
PaulDinam - 23.03.2013
Oh so if you wan't to call it every hour, change it to 1.
1 hour = 3600000
Re: Player dont get cancer -
Don_Cage - 23.03.2013
Ok then i did something good haha. Anyway i tried it again now after making it save in file and nothing have changed, still comes nothing even after 2 smokes
Re: Player dont get cancer -
Don_Cage - 23.03.2013
bump