Advertisement
XEnergyX

Lotto Shit dies & das

Nov 7th, 2011
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.09 KB | None | 0 0
  1. // das ist jetzt soziemlich alles von oben bis unten gepostet was in meinem lotto system ist
  2.  
  3. forward ShowLotto();
  4. forward Lotto(number);
  5. new LottoTimer = 0;
  6.  
  7. pLottoNr,
  8. format(var, 32, "LottoNr=%d\n",PlayerInfo[playerid][pLottoNr]);fwrite(hFile, var);
  9. PlayerInfo[playerid][pLottoNr] = 0;
  10.  
  11.  
  12. //================================================= Lotto ==========================================
  13. public Lotto(number)
  14. {
  15. new JackpotFallen = 0;
  16. new string[256];
  17. new winner[MAX_PLAYER_NAME];
  18. format(string, sizeof(string), "Lotto: Heute wurde die Losnummer %d gezogen.", number);
  19. OOCOff(COLOR_WHITE, string);
  20. for(new i = 0; i < MAX_PLAYERS; i++)
  21. {
  22. if(IsPlayerConnected(i))
  23. {
  24. if(PlayerInfo[i][pLottoNr] > 0)
  25. {
  26. if(PlayerInfo[i][pLottoNr] == number)
  27. {
  28. JackpotFallen = 1;
  29. GetPlayerName(i, winner, sizeof(winner));
  30. format(string, sizeof(string), "Lotto: %s hat den Jackpot von $%d gewonnen.", winner, Jackpot);
  31. OOCOff(COLOR_WHITE, string);
  32. format(string, sizeof(string), "* Du hast $%d mit deinem Lottoticket gewonnen.", Jackpot);
  33. SendClientMessage(i, COLOR_YELLOW, string);
  34. ConsumingMoney[i] = 1;
  35. GivePlayerMoney(i, Jackpot);
  36. }
  37. else
  38. {
  39. SendClientMessage(i, COLOR_LIGHTBLUE, "Du hast beim Lotto nicht gewonnen.");
  40. }
  41. }
  42. PlayerInfo[i][pLottoNr] = 0;
  43. }
  44. }
  45. if(JackpotFallen)
  46. {
  47. new rand = random(10000); rand += 15000;
  48. Jackpot = rand;
  49. SaveStuff();
  50. format(string, sizeof(string), "Lotto: Der neue Jackpot beträgt $%d.", Jackpot);
  51. OOCOff(COLOR_WHITE, string);
  52. }
  53. else
  54. {
  55. new rand = random(500); rand += 1000;
  56. Jackpot += rand;
  57. SaveStuff();
  58. format(string, sizeof(string), "Lotto: Der Jackpot wurde auf $%d erhöht.", Jackpot);
  59. OOCOff(COLOR_WHITE, string);
  60. }
  61. return 1;
  62. }
  63.  
  64. format(var, 32, "LottoNr=%d\n",PlayerInfo[playerid][pLottoNr]);fwrite(hFile, var);
  65.  
  66. for(new i = 0; i < MAX_PLAYERS; i++)
  67. {
  68. new plname[MAX_PLAYER_NAME];
  69. if (LottoTimer > 0)
  70. LottoTimer--;
  71.  
  72. if (LottoTimer == 1)
  73. {
  74. OOCOff(COLOR_WHITE, "[Lotto]: Die Super Ziehung wurde gestartet!");
  75. new rand = random(90);
  76. if(rand < 70) { rand += 3; }
  77. Lotto(rand);
  78. }
  79.  
  80. else if (LottoTimer == 120)
  81. {
  82. format(string, sizeof(string), "Lotto: Die Lotterie Ziehung beginnt in 2 Minuten, Jackpot: %d", Jackpot);
  83. SendClientMessage(i,COLOR_YELLOW,string);
  84. SendClientMessage(i,COLOR_YELLOW,"Lotto: Gib /Lotto [Nummer] um einen Lotterie-Schein zu kaufen.");
  85. }
  86. else if (LottoTimer == 60)
  87. {
  88. format(string, sizeof(string), "Lotto: Die Lotterie Ziehung beginnt in 1 Minute, Jackpot: %d", Jackpot);
  89. SendClientMessage(i,COLOR_YELLOW,string);
  90. SendClientMessage(i,COLOR_YELLOW,"Lotto: Gib /Lotto [Nummer] um einen Lotterie-Schein zu kaufen.");
  91. }
  92.  
  93. new lotto = PlayerInfo[targetid][pLottoNr];
  94.  
  95. public ShowLotto()
  96. {
  97. LottoTimer = 180;
  98. OOCOff(COLOR_WHITE, "[Lotto]: Die Lotto Losziehung wurde automatisch gestartet!(3 Minuten)");
  99. }
  100.  
  101. SetTimer( "ShowLotto" , 7200000, true );
  102.  
  103. format(var, 32, "LottoNr=%d\n",PlayerInfo[playerid][pLottoNr]);fwrite(hFile, var);
  104.  
  105. if( strcmp( key , "LottoNr" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLottoNr] = strval( val ); }
  106.  
  107. if(strcmp(cmd, "/startlotto", true) == 0)
  108. {
  109. if(IsPlayerConnected(playerid))
  110. {
  111. if(PlayerInfo[playerid][pAdmin] >= 21 || PlayerInfo[playerid][pMember] == 9 || PlayerInfo[playerid][pLeader] == 9)
  112. {
  113. LottoTimer = 180;
  114. OOCOff(COLOR_WHITE, "[Lotto]: Die Lotto Losziehung wurde automatisch gestartet!(3 Minuten)");
  115. }
  116. else
  117. {
  118. SendClientMessage(playerid, COLOR_GREY, " Du bist kein Reporter!");
  119. return 1;
  120. }
  121. }
  122. return 1;
  123. }
  124.  
  125. if(strcmp(cmd, "/lotto", true) == 0)
  126. {
  127. if(IsPlayerConnected(playerid))
  128. {
  129. if(PlayerInfo[playerid][pLottoNr] > 0)
  130. {
  131. SendClientMessage(playerid, COLOR_GREY, " Du hast bereits ein Lotterielos !");
  132. return 1;
  133. }
  134. if(GetPlayerMoney(playerid) < 50)
  135. {
  136. SendClientMessage(playerid, COLOR_GREY, " Du brauchst $30 um ein Lotterielos kaufen zu können !");
  137. return 1;
  138. }
  139. tmp = strtok(cmdtext, idx);
  140. if(!strlen(tmp)) {
  141. SendClientMessage(playerid, COLOR_WHITE,"Benutze: /lotto [nummer]");
  142. return 1;
  143. }
  144. new lottonr = strval(tmp);
  145. if(lottonr < 1 || lottonr > 100) { SendClientMessage(playerid, COLOR_GREY, " Deine Lotterienummer darf nicht unter 1 oder über 100 liegen!"); return 1; }
  146. format(string, sizeof(string), "* Du hast dir ein Lotterielos mit der Nummer: %d gekauft, viel Glück.", lottonr);
  147. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  148. GivePlayerMoney(playerid, - 30);
  149. Jackpot += 40;
  150. PlayerInfo[playerid][pLottoNr] = lottonr;
  151. }
  152. return 1;
  153. }
  154.  
  155. format(var, 32, "LottoNr=%d\n",PlayerInfo[playerid][pLottoNr]);fwrite(hFile, var);
  156.  
  157. new lotto = PlayerInfo[targetid][pLottoNr];
  158.  
  159.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement