Advertisement
Guest User

lotto.pwn

a guest
Jun 16th, 2018
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. //Made by lokii.
  2.  
  3. #include <a_samp> //credits to samp team.
  4. #include <zcmd> // credits to zeex.
  5.  
  6. static bool:inlotto[MAX_PLAYERS] = {false,...};
  7. static bool:active = false;
  8. static timer;
  9.  
  10. public OnFilterScriptExit()
  11. {
  12. KillTimer(timer);
  13. for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
  14. {
  15. if(!IsPlayerConnected(i) || IsPlayerNPC(i)) continue;
  16. inlotto[i] = false;
  17. }
  18. return 1;
  19. }
  20.  
  21. public OnPlayerDisconnect(playerid)
  22. {
  23. inlotto[playerid] = false;
  24. return 1;
  25. }
  26.  
  27. forward Lotto();
  28.  
  29. public Lotto()
  30. {
  31. static str[74], name[24], rand1, rand2;
  32. active = false;
  33. for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
  34. {
  35. PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
  36. }
  37. rand1 = random(GetMaxPlayers()+250);
  38. rand2 = random(500000-50000)+50000;
  39. if(!IsPlayerConnected(rand1) || IsPlayerNPC(rand1) || !inlotto[rand1])
  40. {
  41. SendClientMessageToAll(-1, "Nobody won the lotto");
  42. }
  43. else
  44. {
  45. GetPlayerName(rand1, name, sizeof(name));
  46. format(str, sizeof(str), "%s {FFFFFF}won the lotto ({00FF00}$%d{FFFFFF})", name, rand2);
  47. SendClientMessageToAll(0xFFFF00FF, str);
  48. GivePlayerMoney(rand1, rand2);
  49. }
  50. return 1;
  51. }
  52.  
  53. CMD:joinlotto(playerid)
  54. {
  55. if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, 0xFF0000FF, "You dont have enough money");
  56. inlotto[playerid] = true;
  57. PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
  58. GivePlayerMoney(playerid, -500);
  59. SendClientMessage(playerid, 0x00FF00FF, "You joined lotto {FF0000}-$500");
  60. return 1;
  61. }
  62.  
  63. CMD:setlotto(playerid)
  64. {
  65. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You'r not allowed to use this command");
  66. if(active) return SendClientMessage(playerid, 0xFF0000FF, "The lotto is allready active");
  67. for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
  68. {
  69. PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
  70. }
  71. SendClientMessageToAll(-1, "Lotto started /joinlotto ({00FF00}$500{FFFFFF}) to enter");
  72. active = true;
  73. timer = SetTimer("Lotto", 120000, false);
  74. return 1;
  75. }
  76.  
  77.  
  78. //EOF.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement