Guest User

Untitled

a guest
Mar 30th, 2014
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.32 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3. #include <sscanf2>
  4.  
  5. #define Czerwony 0xFF0000FF
  6. #define Zielony 0x008000FF
  7.  
  8. #undef MAX_PLAYERS
  9. #define MAX_PLAYERS 30
  10.  
  11. new pula, prezent;
  12.  
  13. #define rand(%0,%1) (random(%1-%0)+%0)
  14.  
  15. public OnPlayerPickUpPickup(playerid, pickupid)
  16. {
  17. new string[320];
  18. if(pickupid == prezent)
  19. {
  20. if(IsPlayerAdmin(playerid))
  21. return SendClientMessage(playerid, Czerwony, "Administrator nie może zebrać prezentu!");
  22. {
  23. GivePlayerMoney(playerid, pula);
  24. format(string, sizeof(string), "Gratulacje! Znalazłeś(aś) prezent jako pierwszy(a) i otrzymałeś(aś) nagrodę w wysokości %d$.", pula);
  25. SendClientMessage(playerid, Zielony, string);
  26. format(string, sizeof(string), "Gracz %s znalazł prezent jako pierwszy i otrzymał %d$. Gratulacje!", pName(playerid), pula);
  27. SendClientMessageToAll(Zielony, string);
  28. pula = 0;
  29. DestroyPickup(prezent);
  30. printf("Gracz %s zebrał prezent.", pName(playerid));
  31. }
  32. }
  33. return 1;
  34. }
  35.  
  36. CMD:prezent(playerid, params[])
  37. {
  38. new string[320];
  39. if(!IsPlayerAdmin(playerid))
  40. return SendClientMessage(playerid, Czerwony, "Nie jesteś administratorem!");
  41. if(GetPVarInt(playerid, "Prezent") == 1)
  42. return SendClientMessage(playerid, Czerwony, "Można postawić tylko jeden prezent!");
  43.  
  44. {
  45. new Float:PosX, Float:PosY, Float:PosZ;
  46. GetPlayerPos(playerid, PosX, PosY, PosZ);
  47. SetPVarInt(playerid, "Prezent", 1);
  48. prezent = CreatePickup(19057, 1, PosX, PosY, PosZ-0.1, GetPlayerVirtualWorld(playerid));
  49. pula = (100000000+random(400000000));
  50. SendClientMessage(playerid, Zielony, "Prezent stworzony pomyślnie.");
  51. format(string, sizeof(string), "Administrator %s(ID: %d) stworzył prezent. Znajdź go, a czeka na ciebie nagroda w wysokości %d$.", pName(playerid), playerid, pula);
  52. SendClientMessageToAll(Zielony, string);
  53. printf("Administrator %s stworzył prezent.", pName(playerid));
  54. }
  55. return 1;
  56. }
  57.  
  58. CMD:usunprezent(playerid, params[])
  59. {
  60. new string[320];
  61. if(!IsPlayerAdmin(playerid))
  62. return SendClientMessage(playerid, Czerwony, "Nie jesteś administratorem!");
  63. if(GetPVarInt(playerid, "Prezent") != 1)
  64. return SendClientMessage(playerid, Czerwony, "Nie ma prezentu do usunięcia.");
  65. {
  66. SetPVarInt(playerid, "Prezent", 0);
  67. DestroyPickup(prezent);
  68. pula = 0;
  69. SendClientMessage(playerid, Zielony, "Prezent usunięty pomyślnie.");
  70. format(string, sizeof(string), "Administrator %s(ID: %d) usunął prezent.", playerid, playerid);
  71. SendClientMessageToAll(Zielony, string);
  72. printf("Administrator %s usunął prezent.", pName(playerid));
  73. }
  74. return 1;
  75. }
  76. stock pName(playerid)
  77. {
  78. new nick[MAX_PLAYER_NAME];
  79. GetPlayerName(playerid, nick, MAX_PLAYER_NAME);
  80. return nick;
  81. }
Advertisement
Add Comment
Please, Sign In to add comment