Advertisement
XEnergyX

Lotto System

Nov 7th, 2011
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. //================================================= Lotto ==========================================
  2. public Lotto(number)
  3. {
  4. new JackpotFallen = 0;
  5. new string[256];
  6. new winner[MAX_PLAYER_NAME];
  7. format(string, sizeof(string), "Lotto: Heute wurde die Losnummer %d gezogen.", number);
  8. OOCOff(COLOR_WHITE, string);
  9. for(new i = 0; i < MAX_PLAYERS; i++)
  10. {
  11. if(IsPlayerConnected(i))
  12. {
  13. if(PlayerInfo[i][pLottoNr] > 0)
  14. {
  15. if(PlayerInfo[i][pLottoNr] == number)
  16. {
  17. JackpotFallen = 1;
  18. GetPlayerName(i, winner, sizeof(winner));
  19. format(string, sizeof(string), "Lotto: %s hat den Jackpot von $%d gewonnen.", winner, Jackpot);
  20. OOCOff(COLOR_WHITE, string);
  21. format(string, sizeof(string), "* Du hast $%d mit deinem Lottoticket gewonnen.", Jackpot);
  22. SendClientMessage(i, COLOR_YELLOW, string);
  23. ConsumingMoney[i] = 1;
  24. GivePlayerMoney(i, Jackpot);
  25. }
  26. else
  27. {
  28. SendClientMessage(i, COLOR_LIGHTBLUE, "Du hast beim Lotto nicht gewonnen.");
  29. }
  30. }
  31. PlayerInfo[i][pLottoNr] = 0;
  32. }
  33. }
  34. if(JackpotFallen)
  35. {
  36. new rand = random(10000); rand += 15000;
  37. Jackpot = rand;
  38. SaveStuff();
  39. format(string, sizeof(string), "Lotto: Der neue Jackpot beträgt $%d.", Jackpot);
  40. OOCOff(COLOR_WHITE, string);
  41. }
  42. else
  43. {
  44. new rand = random(500); rand += 1000;
  45. Jackpot += rand;
  46. SaveStuff();
  47. format(string, sizeof(string), "Lotto: Der Jackpot wurde auf $%d erhöht.", Jackpot);
  48. OOCOff(COLOR_WHITE, string);
  49. }
  50. return 1;
  51. }
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement