Posts: 1,241
Threads: 67
Joined: Dec 2013
pawn Код:
new DiseasesNamesNumber = 6;
pawn Код:
new Diseases[][]
{
"HIV",
"Syphilis",
"Crazy Chicken Flu",
"Mad Cow Disease",
"Nothing"
};
pawn Код:
enum pInfo // Maybe this will be useful for you later.
{
pDiseases
};
pawn Код:
new Got;
new rand;
rand = random(DiseasesNamesNumber);
if(Got <= 0)
{
SendClientMessage(playerid, COLOR_GREY, "You didn't got any Diseases.");
return 1;
}
else if(rand == 0)
{
SendClientMessage(playerid, COLOR_GREY, "You got HIV now! Go and see a doctor.");
SetPlayerHealth(playerid, GetPlayerHealth(playerid)-10);
return 1;
}
else if(rand == 1)
{
SendClientMessage(playerid, COLOR_GREY, "You got Syphilis now! Go and see a doctor.");
SetPlayerHealth(playerid, GetPlayerHealth(playerid)-20);
return 1;
}
else if(rand == 2)
{
SendClientMessage(playerid, COLOR_GREY, "You got Crazy Chicken Flu now! Go and see a doctor.");
SetPlayerHealth(playerid, GetPlayerHealth(playerid)-30);
return 1;
}
else if(rand == 3)
{
SendClientMessage(playerid, COLOR_GREY, "You got Mad Cow Disease now! Go and see a doctor.");
SetPlayerHealth(playerid, GetPlayerHealth(playerid)-40);
return 1;
}
Posts: 864
Threads: 88
Joined: Jul 2012
Reputation:
0
Perfect, now I am planning on adding a checkpoint at the Hospital in LV to cure the diseases, how would I detect which disease they have and how would I save which disease they have. Like if they disconnect with a disease, how would I detect which disease they had?
Posts: 1,241
Threads: 67
Joined: Dec 2013
Add this to your
pawn Код:
public OnPlayerConnect
PlayerInfo[playerid][pDiseases]
Don't forget to add new line in your users file called Diseases.
pawn Код:
public OnPlayerLogin
PlayerInfo[playerid][pDiseases] = dini_Int(string2,"Diseases"); // Just Like this.
And to make difference between Diseases use this
pawn Код:
PlayerInfo[playerid][pDiseases] = The Diseases ID.
Just like this.
pawn Код:
else if(rand == 1)
{
SendClientMessage(playerid, COLOR_GREY, "You got Syphilis now! Go and see a doctor.");
SetPlayerHealth(playerid, GetPlayerHealth(playerid)-20);
PlayerInfo[playerid][pDiseases] = 1;
return 1;
}
Make sure to load the diseases, And for the Hospital checkpoints, Just use SetPlayerCheckPoint