one qeustion with random
#1

well, how I can use random? I need it, I show what exactly I need
pawn Код:
if(ShitInfo[playerid][pLol] == random) // I need to be random between 25 and 40
{
ShitInfo[playerid][pLol] =0;
SendClientMessage(playerid,COLOR_WHITE,"( ! ) yes !");
}
help me plz !
Reply
#2

pawn Код:
new rnd = random((40 - 25)) + 25;
if(ShitInfo[playerid][pLol] == rnd)
{
ShitInfo[playerid][pLol] =0;
SendClientMessage(playerid,COLOR_WHITE,"( ! ) yes !");
}
Reply
#3

T0pAz is correct, and if you're going to use random more.
You could add a definition at the top of your script

pawn Код:
#define random(%1,%2) random(%2-%1)+%1
And then you can just use
pawn Код:
new value = random(2, 7); // Value will contain a random number ranging from 2 to 6.
Reply
#4

thanks, I'll try
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)