SA-MP Forums Archive
Randoms Problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Randoms Problem (/showthread.php?tid=458366)



Randoms Problem - nor15 - 16.08.2013

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


AW: Randoms Problem - Nero_3D - 16.08.2013

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]


Re: Randoms Problem - nor15 - 16.08.2013

Thanks it Works.