how to make a random command?
#1

hey people i'm posting to ask how i could do a random command, like that gives a weapon between defined ids

ex :

i type /random

it could give me the weapon id 21, 22,23,24,25,26,27,28,29 or 30

i though about :

if(strcmp(cmdtext, "/random", true) == 0)
{
new random { its here that i don't know what to do};
GivePlayerWeapon(playerid, random, 200);
return 1;
}
Reply
#2

pawn Код:
if(strcmp(cmdtext, "/random", true) == 0)
{
    new values[] = {21, 22, 23, 24, 25, 26, 27, 28, 29, 30};
    GivePlayerWeapon(playerid, values[random(sizeof values)], 200);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)