Need help with random numbers...
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  // define strtok stuff here, or use dcmd
 
  new pLotto;
  new RandNumber;

  if(strcmp(cmd,"/lotto",true)==0) // then it pops a message " You have to type "/lotto [number]"
  {
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp) return SendClientMessage(playerid, COLOR_RED, "Usage: /lotto [number]");
 
    pLotto = strval(tmp);
    if (PlayerToPoint(3.0, playerid,1653.9108,-1655.2948,22.5156))
    {
      RandNumber = 1+random(10);
      if(RandNumber == pLotto)
      {
        GameTextForPlayer(playerid, "~w~Congratulations!~n~You won ~g~$10000",5000, 5);
        GivePlayerMoney(playerid, 10000);
      }
      else
      {
        SendClientMessage(playerid, COLOR_RED, "Sorry, you didn't win this time!");
      }
      return 1;
    }
  }
  return 0;
}
Reply


Messages In This Thread
Need help with random numbers... - by *BueNoOo* - 18.06.2009, 11:43
Re: Need help with random numbers... - by Vince - 18.06.2009, 12:01
Re: Need help with random numbers... - by *BueNoOo* - 18.06.2009, 12:08
Re: Need help with random numbers... - by Grim_ - 18.06.2009, 12:09
Re: Need help with random numbers... - by *BueNoOo* - 18.06.2009, 12:20
Re: Need help with random numbers... - by Grim_ - 18.06.2009, 12:22
Re: Need help with random numbers... - by *BueNoOo* - 18.06.2009, 12:30
Re: Need help with random numbers... - by Grim_ - 18.06.2009, 12:31
Re: Need help with random numbers... - by *BueNoOo* - 18.06.2009, 12:36
Re: Need help with random numbers... - by Vince - 18.06.2009, 13:10

Forum Jump:


Users browsing this thread: 3 Guest(s)