Guest User

Untitled

a guest
Apr 3rd, 2016
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.58 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3. #include <sscanf2>
  4. #define COLOR_RED 0xFF0000FF
  5. #define COLOR_YELLOW 0x00FFFFFF
  6. #define COLOR_GREEN 0x00FF00FF
  7. #define cookies 3 // amount of cookies
  8. new pickupids, pickup, bool:takenbyplayer;
  9.  
  10. public OnFilterScriptInit()
  11. {
  12. print("************* Hidden Pickup Creator v3 Loaded *************");
  13. print("----------------------[smileyforcheat]---------------------");
  14. print("***********************************************************");
  15. return 1;
  16. }
  17.  
  18. COMMAND:createhiddenpickup(playerid, params[])
  19. {
  20. new szString[128], Float:X, Float:Y, Float:Z;
  21. if(sscanf(params, "d", pickupids)) return SendClientMessage(playerid, COLOR_RED, "* You have to insert the pickup id."),
  22. GameTextForPlayer(playerid, "~r~~h~You have to~n~insert the pickup id", 3000, 3);
  23. takenbyplayer = false;
  24. GetPlayerPos(playerid, Float:X, Float:Y, Float:Z);
  25. GetXYInFrontOfPlayer(playerid, Float:X, Float:Y, 2.0);
  26. pickup = CreatePickup(pickupids, 2, Float:X, Float:Y, Float:Z, GetPlayerVirtualWorld(playerid));
  27. format(szString, sizeof(szString), "* You have been placed the hidden pickup for %d Cookies", cookies);
  28. SendClientMessage(playerid, COLOR_YELLOW, szString);
  29. return 1;
  30. }
  31.  
  32. COMMAND:rocket(playerid, params[])
  33. {
  34. if(0 >= GetPVarInt(playerid, "Cookies"))
  35. {SendClientMessage(playerid, COLOR_RED, "* You dont have any cookies to change it into a rockets!");}
  36. else
  37. {
  38. GivePlayerWeapon(playerid, WEAPON_ROCKETLAUNCHER, 10), SetPVarInt(playerid, "Cookies", GetPVarInt(playerid, "Cookies")-1);
  39. new szString[128];
  40. format(szString, sizeof(szString), "* You have been used your cookies to get rockets. You have %d cookies left.", GetPVarInt(playerid, "Cookies"));
  41. SendClientMessage(playerid, COLOR_GREEN, szString);}
  42. return 1;
  43. }
  44. COMMAND:deletehiddenpickup(playerid, params[])
  45. {
  46. DestroyPickup(pickup);
  47. SendClientMessage(playerid, COLOR_YELLOW, "* The hidden pickup has been deleted");
  48. takenbyplayer = false;
  49. return 1;
  50. }
  51. COMMAND:mycookies(playerid, params[])
  52. {
  53. new szString[128];
  54. format(szString, sizeof(szString), "* You have %d cookies, you can type rocket if you own ones", GetPVarInt(playerid, "Cookies"));
  55. SendClientMessage(playerid, COLOR_GREEN, szString);
  56. return 1;
  57. }
  58. COMMAND:chp(playerid, params[])
  59. {
  60. return cmd_createhiddenpickup(playerid, params);
  61. }
  62. COMMAND:dhp(playerid, params[])
  63. {
  64. return cmd_deletehiddenpickup(playerid, params);
  65. }
  66.  
  67. public OnPlayerPickUpPickup(playerid, pickupid)
  68. {
  69. if(pickupid == pickup)
  70. {
  71. if(takenbyplayer == true) { SendClientMessage(playerid, COLOR_YELLOW, "* Sorry the hidden pickup already taken by other players"); return 1;}
  72. new szString[128];
  73. takenbyplayer = true;
  74. format(szString, sizeof(szString), "* You have been found the hidden pickup for %d cookies", cookies);
  75. SendClientMessage(playerid, COLOR_GREEN, szString);
  76. SendClientMessage(playerid, COLOR_GREEN, "* You can use your cookies by typing /rocket");
  77. SetPVarInt(playerid, "Cookies", GetPVarInt(playerid, "Cookies")+3);
  78. new szString2[128], szName[MAX_PLAYER_NAME];
  79. GetPlayerName(playerid, szName, sizeof(szName));
  80. format(szString2, sizeof(szString2), "~y~~h~%s (ID:%d)~n~~g~~h~has been found~n~~b~~h~the hidden pickup~n~~g~~h~and won 3 cookies", szName, playerid);
  81. GameTextForAll(szString2, 5000, 3);
  82. }
  83. return 1;
  84. }
  85.  
  86. stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
  87. {
  88. new Float:a;
  89. GetPlayerPos(playerid, x, y, a);
  90. GetPlayerFacingAngle(playerid, a);
  91. if (GetPlayerVehicleID(playerid)) {GetVehicleZAngle(GetPlayerVehicleID(playerid), a);}
  92. x += (distance * floatsin(-a, degrees));
  93. y += (distance * floatcos(-a, degrees));
  94. }
Advertisement
Add Comment
Please, Sign In to add comment