Advertisement
Private200

Drugger Job - V3

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