Randoms Problem
#1

I use for random STD's

pawn Код:
new STDs[5][] =
    {
       "Chlamydia",
       "Gonorrhea",
       "Syphyllis",
       "Hepatitis B",
       "STD"
    };
pawn Код:
new randstd =random(sizeof(STDs));
    if(gTeam[playerid] == TEAM_RAPIST)
    {
        format(string,sizeof(string),"You have grabbed %s(%d) and Infected them with %s!",PlayerName(ID),ID,randstd);
        SendClientMessage(playerid,COLOR_ORANGE,string);
        HasRapedRecently[playerid] =120;

        format(string,sizeof(string),"%s(%d) has grabbed you and infected you with %s!",PlayerName(playerid),playerid,randstd);
        SendClientMessage(ID,COLOR_ORANGE,string);
        IncreaseWantedLevel(playerid,4);
        IncreasePlayerScore(playerid,2);

        format(string,sizeof(string),"[INFECTION] %s(%d) has grabbed %s(%d) and Infected them with %s!.",PlayerName(playerid),playerid,PlayerName(ID),ID,randstd);
        SendClientMessageToAll(COLOR_ORANGE,string);
        return 1;
     }
But when i do /rape in game it say ExampleA(0) has grabbed ExampleB(1) and Infected them with.
It doesn't write any of the randoms
Reply
#2

Thats because randstd is just the random number not the string
To print out the string you need to do in the format STD[randstd]
Reply
#3

Thanks it Works.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)