Advertisement
Private200

Drugger Job/System

Mar 29th, 2013
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.14 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3.  
  4. // Some configurations for the script to work
  5.  
  6. new IsDrugger[MAX_PLAYERS];
  7. new HasMaterials[MAX_PLAYERS];
  8. new HasDrugs[MAX_PLAYERS];
  9. new IsDrunk[MAX_PLAYERS];
  10. new lightblue = 0xADD8E6FF;
  11. new red = 0xFF0000AA;
  12.  
  13. public OnFilterScriptInit()
  14. {
  15. // Takejob configurations
  16.  
  17. CreatePickup(1239, 1, 2065.2837,-1558.5857,13.4369, -1);
  18. Create3DTextLabel("Drugger job\n/takedruggerjob | /quitdruggerjob", 0xFF0000AA, 2065.2837,-1558.5857,13.4369, 5.0, 0, 0);
  19.  
  20. // pickupmaterials configurations
  21.  
  22. CreatePickup(1254, 1, 2067.4619, -1561.9774, 13.4270, -1);
  23. Create3DTextLabel("Drugger job\n/pickupmaterials", 0xFF0000AA, 2067.4619,-1561.9774,13.4270, 5.0, 0, 0);
  24.  
  25. // createdrugs configurations
  26.  
  27. CreatePickup(1279, 1, 2355.3733, -648.4775, 128.0547, -1);
  28. Create3DTextLabel("Drugger job\n/createdrugs", 0xFF0000AA, 2355.3733, -648.4775, 128.0547, 5.0, 0, 0);
  29.  
  30. return 1;
  31. }
  32.  
  33. public OnPlayerSpawn(playerid)
  34. {
  35. HasDrugs[playerid] = 1;
  36. return 1;
  37. }
  38.  
  39. COMMAND:takedruggerjob(playerid, params[])
  40. {
  41. if(IsDrugger[playerid] == 0)
  42. {
  43. if(IsPlayerInRangeOfPoint(playerid, 1.0, 2065.2837, -1558.5857, 13.4369))
  44. {
  45. IsDrugger[playerid] = 1;
  46. SendClientMessage(playerid, lightblue, "Congratulations. You're now an Drugger. For more help about your job please use '/druggerhelp'.");
  47. }
  48. else
  49. SendClientMessage(playerid, red, "[ERROR] You're not at the place to take the Drugger job.");
  50. }
  51. else
  52. SendClientMessage(playerid, red, "[ERROR] You're already an Drugger.");
  53. return 1;
  54. }
  55.  
  56. COMMAND:quitdruggerjob(playerid, params[])
  57. {
  58. if(IsDrugger[playerid] == 1)
  59. {
  60. SendClientMessage(playerid, lightblue, "You left your drugger job.");
  61. IsDrugger[playerid] = 0;
  62. }
  63. else
  64. SendClientMessage(playerid, red, "[ERROR] You're not an drugger.");
  65. return 1;
  66. }
  67.  
  68. COMMAND:druggerhelp(playerid, params[])
  69. {
  70. new msg[2000];
  71.  
  72. format(msg, 2000, "%s{FFFFFF}Hello Drugger,\n\n\n", msg);
  73. format(msg, 2000, "%s{FFFFFF}These are the commands of your job:\n\n", msg);
  74. format(msg, 2000, "%s{FF0000}1. {FFFFFF}/takedruggerjob -> Takes the Drugger job\n", msg);
  75. format(msg, 2000, "%s{FF0000}2. {FFFFFF}/pickupmaterials -> Picks up the required materials for creating drugs\n", msg);
  76. format(msg, 2000, "%s{FF0000}3. {FFFFFF}/quitdruggerjob -> Quits the Drugger job\n", msg);
  77. format(msg, 2000, "%s{FF0000}4. {FFFFFF}/createdrugs -> Creates drugs\n", msg);
  78. format(msg, 2000, "%s{FF0000}5. {FFFFFF}/givedrugs -> You can trade drugs for cash with other players near you\n", msg);
  79. format(msg, 2000, "%s{FF0000}6. {FFFFFF}/usedrugs -> You can use the drugs you got\n", msg);
  80. format(msg, 2000, "%s{FF0000}7. {FFFFFF}/mydrugs -> Checks if you got drugs or not\n\n", msg);
  81. format(msg, 2000, "%s{FFFFFF}Thank you for reading the help menu", msg);
  82.  
  83. if(IsDrugger[playerid] == 1)
  84. {
  85. ShowPlayerDialog(playerid, 5678, DIALOG_STYLE_MSGBOX, "{FFFFFF}Drugger Help", msg, "Okay", "");
  86. return 1;
  87. }
  88. else
  89. SendClientMessage(playerid, red, "[ERROR] You're not an Drugger.");
  90. return 1;
  91. }
  92. COMMAND:pickupmaterials(playerid, params[])
  93. {
  94. if(IsDrugger[playerid] == 1)
  95. {
  96. if(IsPlayerInRangeOfPoint(playerid, 1.0, 2067.4619,-1561.9774,13.4270))
  97. {
  98. SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
  99. SetTimer("pickingmaterials", 5000, false);
  100. SendClientMessage(playerid, lightblue, "You started loading part of drugs materials.");
  101. TogglePlayerControllable(playerid, 0);
  102. }
  103. else
  104. SendClientMessage(playerid, red, "[ERROR] You're not at the materials pickup position.");
  105. }
  106. else
  107. SendClientMessage(playerid, red, "[ERROR] You're not an Drugger.");
  108. }
  109.  
  110. forward pickingmaterials(playerid);
  111.  
  112. public pickingmaterials(playerid)
  113. {
  114. HasMaterials[playerid] = 1;
  115. SendClientMessage(playerid, lightblue, "You have loaded the materials successfully. Take care of police.");
  116. TogglePlayerControllable(playerid, 1);
  117. SetPlayerCheckpoint(playerid, 2355.3733, -648.4775, 128.0547, 1.0);
  118. SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
  119. return 1;
  120. }
  121.  
  122. COMMAND:createdrugs(playerid, params[])
  123. {
  124. if(IsDrugger[playerid] == 1)
  125. {
  126. if(IsPlayerInRangeOfPoint(playerid, 1.0, 2355.3733, -648.4775, 128.0547))
  127. {
  128. HasDrugs[playerid] = 1;
  129. SendClientMessage(playerid, lightblue, "Congratulations. You've created drugs.");
  130. }
  131. else
  132. SendClientMessage(playerid, red, "[ERROR] You're not at the drugs creation place.");
  133. }
  134. else
  135. SendClientMessage(playerid, red, "[ERROR] You're not an Drugger.");
  136. }
  137.  
  138. COMMAND:usedrugs(playerid, params[])
  139. {
  140. if(HasDrugs[playerid] == 1)
  141. {
  142. HasDrugs[playerid] = 0;
  143. SetTimer("drunkstart", 5000, false);
  144. TogglePlayerControllable(playerid, 0);
  145. SendClientMessage(playerid, lightblue, "You're now using the drugs. It will take a while till you finish it all.");
  146. }
  147. else
  148. SendClientMessage(playerid, red, "[ERROR] You don't have drugs. Ask someone who has it to give it to you.");
  149. }
  150.  
  151. forward drunkstart(playerid);
  152.  
  153. public drunkstart(playerid)
  154. {
  155. IsDrunk[playerid] = 1;
  156. TogglePlayerControllable(playerid, 1);
  157. SetPlayerDrunkLevel(playerid, 50000);
  158. SendClientMessage(playerid, lightblue, "You're now under effects of drugs. Be sure the cops wont bust you.");
  159. SetTimer("drunkmiddle", 15000, false);
  160. return 1;
  161. }
  162.  
  163. forward drunkmiddle(playerid);
  164.  
  165. public drunkmiddle(playerid)
  166. {
  167. SendClientMessage(playerid, lightblue, "You've slowly recovering your self from the drugs.");
  168. SetPlayerDrunkLevel(playerid, 25000);
  169. SetTimer("drunkend", 7500, false);
  170. return 1;
  171. }
  172.  
  173. forward drunkend(playerid);
  174.  
  175. public drunkend(playerid)
  176. {
  177. SetPlayerDrunkLevel(playerid, 0);
  178. SendClientMessage(playerid, lightblue, "You fully recovered your self from the drugs.");
  179. IsDrunk[playerid] = 0;
  180. return 1;
  181. }
  182.  
  183. COMMAND:mydrugs(playerid, params[])
  184. {
  185. if(HasDrugs[playerid] == 1)
  186. {
  187. SendClientMessage(playerid, lightblue, "You have drugs in your bag.");
  188. }
  189. else if(HasDrugs[playerid] == 0)
  190. {
  191. SendClientMessage(playerid, lightblue, "You don't have any drugs in your bag.");
  192. }
  193. return 1;
  194. }
  195.  
  196. COMMAND:givedrugs(playerid, params[])
  197. {
  198. new OtherPlayer, OtherPlayerName[24], msg[2000], YourName[24];
  199. new Float:x, Float:y, Float:z;
  200. GetPlayerPos(OtherPlayer, x, y, z);
  201.  
  202. if(HasDrugs[playerid] == 1)
  203. {
  204. if(IsPlayerInRangeOfPoint(playerid, 2.0, x, y, z))
  205. {
  206. GetPlayerName(OtherPlayer, OtherPlayerName, sizeof(OtherPlayerName));
  207. GetPlayerName(playerid, YourName, sizeof(YourName));
  208. HasDrugs[OtherPlayer] = 1;
  209. HasDrugs[playerid] = 0;
  210. format(msg, 2000, "You've sent drugs to %s.", OtherPlayerName);
  211. SendClientMessage(playerid, lightblue, msg);
  212. format(msg, 2000, "You've recieved drugs from %s.", YourName);
  213. SendClientMessage(OtherPlayer, lightblue, msg);
  214. }
  215. else
  216. SendClientMessage(playerid, red, "[ERROR] You're not near that person.");
  217. }
  218. else
  219. SendClientMessage(playerid, red, "[ERROR] You can't send drugs you don't own.");
  220. return 1;
  221. }
  222. public OnPlayerEnterCheckpoint(playerid)
  223. {
  224. DisablePlayerCheckpoint(playerid);
  225. return 1;
  226. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement