Rape Diseases Array help
#1

Hi.

Here is my diseases array:
Код:
new Diseases[][]
{
	"HIV",
	"Syphilis",
	"Crazy Chicken Flu",
	"Mad Cow Disease",
        "Nothing"
};
Код:
GetPlayerName(playerid, RapistName, 24);
	        GetPlayerName(targetid, VictimName, 24);
	        
	        new rand = random(sizeof(Diseases));
	        
	        format(string, 128, "You have just raped %s and gave them %s!", VictimName, rand);
How would I go about detecting which disease the script picks at random, and then do some functions like SetPlayerHealth(playerid, GetPlayerHealth(playerid)-10); depending on which disease the player gets?
Reply
#2

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;
                }
Reply
#3

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?
Reply
#4

Add this to your
pawn Код:
enum pInfo
{
pDiseases
};
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
Reply
#5

For OnPlayerConnect, what do I do there?
Quote:

public OnPlayerConnect
PlayerInfo[playerid][pDiseases]

?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)