Random Number Generator
#2

Yes, using random(value):

pawn Code:
random(5); // this will return a number from 0 to 4
Example:
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
  new
    rand = random(10);

  if(strval(cmdtext) == rand)
  {
    SendClientMessage(playerid, COLOR, "You got it!");
    GivePlayerCash(playerid, 1000000);
    return 0;
  }
  return 1;
}
Reply


Messages In This Thread
Random Number Generator - by master000 - 02.03.2010, 20:27
Re: Random Number Generator - by Miguel - 02.03.2010, 21:18
Re: Random Number Generator - by master000 - 03.03.2010, 00:18

Forum Jump:


Users browsing this thread: 1 Guest(s)