Guest User

Untitled

a guest
Jul 31st, 2015
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.61 KB | None | 0 0
  1. CMD:trunk(playerid, params[])
  2. {
  3. if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
  4. new item[32],usage[24], string[128], slot;
  5. new vehicleid = GetClosestVehicle(playerid);
  6. new engine, lights, alarm, doors, bonnet, boot, objective;
  7. GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  8. if(boot == 0) return SendClientMessage(playerid, COLOUR_GREY, "You are not accessing any trunk.");
  9. if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOUR_GREY, "You must get out of the vehicle to use this.");
  10. if(VehicleSQLID[vehicleid] < 1) return SendClientMessage(playerid, COLOUR_GREY, "You cannot use this vehicle's trunk. (Admin Spawned/Static).");
  11. if(sscanf(params, "s[24]S(0)[32]D(0)",usage,item, slot))
  12. {
  13. SendClientMessage(playerid, COLOUR_GREY, "Usage: /trunk [usage]");
  14. SendClientMessage(playerid, COLOUR_GREY, "Usages: Store, Get, View, Weapons");
  15. return 1;//ok take me back to the place that's not working
  16. }
  17.  
  18. if(IsPlayerInRangeOfVehicle(playerid, vehicleid,5))
  19. {
  20. if(!strcmp(usage, "store", true))
  21. {
  22. if(sscanf(params, "s[24]s[32]",usage,item))
  23. {
  24. SendClientMessage(playerid, COLOUR_GREY, "Usage:/trunk store [item]");
  25. SendClientMessage(playerid, COLOUR_GREY, "Available Items: Weed, Cocaine, Money, Armour");
  26. return 1;
  27.  
  28. }
  29. if(!strcmp(item, "weed", true))
  30. {
  31. if(sscanf(params, "s[24]s[32]d",usage,item,slot))
  32. {
  33. SendClientMessage(playerid, COLOUR_GREY, "Usage: /trunk store weed [amount]");
  34. return 1;
  35.  
  36. }
  37. if(slot > Weed[playerid]) return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much weed.");
  38. VehWeed[vehicleid] += slot;
  39. Weed[playerid] -= slot;
  40. format(string, sizeof(string), "You have stored a %d gram(s) of weed in your vehicle's trunk.", slot);
  41. SendClientMessage(playerid, COLOUR_BLUE, string);
  42. format(string, sizeof(string), "* %s has stored some drugs in the vehicle's trunk *", GetNameEx(playerid));
  43. ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
  44. }
  45. if(!strcmp(item, "cocaine", true))
  46. {
  47. if(sscanf(params, "s[24]s[32]d",usage,item,slot))
  48. {
  49. SendClientMessage(playerid, COLOUR_GREY, "Usage: /trunk store cocaine [amount]");
  50. return 1;
  51.  
  52. }
  53. if(slot > Cocaine[playerid]) return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much cocaine.");
  54. VehCoke[vehicleid] += slot;
  55. Cocaine[playerid] -= slot;
  56. if(VehicleSQLID[vehicleid] > 0)
  57. {
  58. MySQL_SetInteger(VehicleSQLID[vehicleid], "VehCoke", VehCoke[vehicleid], "vehicles");
  59. MySQL_SetInteger(PlayerSQLID[playerid], "Cocaine", Cocaine[playerid], "accounts");
  60. }
  61. format(string, sizeof(string), "You have stored a %d gram(s) of cocaine in the vehicle's trunk.", slot);
  62. SendClientMessage(playerid, COLOUR_BLUE, string);
  63. format(string, sizeof(string), "* %s has stored some drugs in the vehicle's trunk. *", GetNameEx(playerid));
  64. ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
  65. }
  66. if(!strcmp(item, "money", true))
  67. {
  68. if(sscanf(params, "s[24]s[32]d",usage,item,slot))
  69. {
  70. SendClientMessage(playerid, COLOUR_GREY, "Usage: /trunk store money [amount]");
  71. return 1;
  72. printf("MONEY AMOUNT CLEARED SSCANF");
  73. printf("VEH ID %d", vehicleid);
  74. }
  75. printf("VEH ID %d", vehicleid);
  76. if(slot > PlayerMoney[playerid]) return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much money.");
  77. if(slot < 1 || slot > 100000) return SendClientMessage(playerid, COLOUR_GREY, "The amount must be between $0 and $100,000");
  78. VehCash[vehicleid] += slot;
  79. PlayerMoney[playerid] -= slot;
  80. GivePlayerMoney(playerid, -slot);
  81. if(VehicleSQLID[vehicleid] > 0)
  82. {
  83. MySQL_SetInteger(VehicleSQLID[vehicleid], "VehCash", VehCash[vehicleid], "vehicles");
  84. MySQL_SetInteger(PlayerSQLID[playerid], "Money", PlayerMoney[playerid], "accounts");
  85. }
  86. format(string, sizeof(string), "You have stored $%s in the vehicle, there is now a total of $%s in the vehicle's trunk.", AddCommas(slot), AddCommas(VehCash[vehicleid]));
  87. SendClientMessage(playerid, COLOUR_BLUE, string);
  88. format(string, sizeof(string), "* %s has stored some money in the vehicle's trunk *", GetNameEx(playerid));
  89.  
  90. ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
  91. }
  92. if(!strcmp(item, "armour", true))
  93. {
  94. GetPlayerArmour(playerid, PlayerArmour[playerid]);
  95. new Float: armour;
  96. if(sscanf(params, "s[24]s[32]f",usage,item,armour))
  97. {
  98. SendClientMessage(playerid, COLOUR_GREY, "Usage: /trunk store armour [amount]");
  99. return 1;
  100. }
  101.  
  102. if(armour < 1 || armour > 100)return SendClientMessage(playerid, COLOUR_GREY, "Amount must be between 0 and 100");
  103. if(armour > PlayerArmour[playerid])return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much armour");
  104.  
  105. VehArmour[vehicleid] += armour;
  106. PlayerArmour[playerid] -= armour;
  107. SetPlayerArmour(playerid, -armour);
  108. if(VehicleSQLID[vehicleid] > 0)
  109. {
  110. MySQL_SetFloat(vehicleid, "VehArmour", VehArmour[vehicleid], "vehicles");
  111. MySQL_SetFloat(PlayerSQLID[playerid], "Armour", PlayerArmour[playerid], "accounts");
  112. }
  113.  
  114. format(string, sizeof(string), "You have stored %d of armour, there is now a total of: %d armour in the vehicle's trunk.", floatround(armour), floatround(VehArmour[vehicleid]));
  115. SendClientMessage(playerid, COLOUR_BLUE, string);
  116. format(string, sizeof(string), "* %s has stored some armour in the vehicle's trunk. *", GetNameEx(playerid));
  117. ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
  118. }
  119. }//close store
  120. if(!strcmp(usage, "get", true))
  121. {
  122. if(sscanf(params, "s[24]s[32]D(0)",usage,item, slot))
  123. {
  124. SendClientMessage(playerid, COLOUR_GREY, "Usage: /trunk get [item]");
  125. SendClientMessage(playerid, COLOUR_GREY, "Available Items: Weed, Cocaine, Money, Armour");
  126. return 1;
  127.  
  128. }
  129. if(!strcmp(item, "weed", true))
  130. {
  131. if(VehicleSQLID[vehicleid] > 0)
  132. {
  133. VehWeed[vehicleid] = MySQL_GetValue(VehicleSQLID[vehicleid], "VehWeed", "vehicles");
  134. Weed[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "weed", "accounts");
  135. }
  136. if(sscanf(params, "s[24]s[32]d",usage,item,slot))
  137. {
  138. SendClientMessage(playerid, COLOUR_GREY, "Usage: /trunk get weed [amount]");
  139.  
  140. return 1;
  141.  
  142. }
  143. if(slot > VehWeed[vehicleid]) return SendClientMessage(playerid, COLOUR_GREY, "There is not this much weed stored in the vehicle.");
  144. VehWeed[vehicleid] -= slot;
  145. Weed[playerid] += slot;
  146. if(VehicleSQLID[vehicleid] > 0)
  147. {
  148. MySQL_SetInteger(VehicleSQLID[vehicleid], "VehWeed", VehWeed[vehicleid], "vehicles");
  149. MySQL_SetInteger(PlayerSQLID[playerid], "Weed", Weed[playerid], "accounts");
  150. }
  151. format(string, sizeof(string), "You have taken %d gram(s) of weed from the vehicle's trunk.", slot);
  152. SendClientMessage(playerid, COLOUR_BLUE, string);
  153. format(string, sizeof(string), "* %s has taken some drugs from the vehicle's trunk. *", GetNameEx(playerid));
  154. ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
  155. }
  156. if(!strcmp(item, "cocaine", true))
  157. {
  158. if(VehicleSQLID[vehicleid] > 0)
  159. {
  160. VehCoke[vehicleid] = MySQL_GetValue(VehicleSQLID[vehicleid], "VehCoke", "vehicles");
  161. Cocaine[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "Cocaine", "accounts");
  162. }
  163. if(sscanf(params, "s[24]s[32]d",usage,item,slot))
  164. {
  165. SendClientMessage(playerid, COLOUR_GREY, "Usage: /trunk get cocaine [amount]");
  166. return 1;
  167.  
  168. }
  169. if(slot > VehCoke[vehicleid]) return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much cocaine.");
  170. VehCoke[vehicleid] -= slot;
  171. Cocaine[playerid] += slot;
  172. if(VehicleSQLID[vehicleid] > 0)
  173. {
  174. MySQL_SetInteger(VehicleSQLID[vehicleid], "VehCoke", VehCoke[vehicleid], "vehicles");
  175. MySQL_SetInteger(PlayerSQLID[playerid], "Cocaine", Cocaine[playerid], "accounts");
  176. }
  177. format(string, sizeof(string), "You have taken %d gram(s) of cocaine from the vehicle's trunk.", slot);
  178. SendClientMessage(playerid, COLOUR_BLUE, string);
  179. format(string, sizeof(string), "* %s has taken some drugs from the vehicle's trunk. *", GetNameEx(playerid));
  180. ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
  181. }
  182. if(!strcmp(item, "money", true))
  183. {
  184. if(sscanf(params, "s[24]s[32]d",usage,item,slot))
  185. {
  186. SendClientMessage(playerid, COLOUR_GREY, "Usage: /trunk get money [amount]");
  187. return 1;
  188.  
  189. }
  190. if(VehCash[vehicleid] < slot) return SendClientMessage(playerid, COLOUR_GREY, "There is not this much money stored in the vehicle.");
  191. if(slot < 1 || slot > 100000) return SendClientMessage(playerid, COLOUR_GREY, "The amount must be between $0 and $100,000");
  192. VehCash[vehicleid] -= slot;
  193. PlayerMoney[playerid] += slot;
  194. GivePlayerMoney(playerid, slot);
  195. if(VehicleSQLID[vehicleid] > 0)
  196. {
  197. MySQL_SetInteger(VehicleSQLID[vehicleid], "VehCash", VehCash[vehicleid], "vehicles");
  198. MySQL_SetInteger(PlayerSQLID[playerid], "Money", PlayerMoney[playerid], "accounts");
  199. }
  200. format(string, sizeof(string), "You have taken $%s from the vehicle, there is now a total of: $%s in the vehicle's trunk.", AddCommas(slot), AddCommas(VehCash[vehicleid]));
  201. SendClientMessage(playerid, COLOUR_BLUE, string);
  202. format(string, sizeof(string), "* %s has taken some money from the vehicle's trunk. *", GetNameEx(playerid));
  203. ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
  204. }
  205. if(!strcmp(item, "armour", true))
  206. {
  207. new Float: armour;
  208. if(sscanf(params, "s[24]s[32]f",usage,item,armour))
  209. {
  210. SendClientMessage(playerid, COLOUR_GREY, "Usage: /trunk get armour [amount]");
  211. return 1;
  212.  
  213. }
  214. if(armour > VehArmour[vehicleid]) return SendClientMessage(playerid, COLOUR_GREY, "There is not this much armour stored in the vehicle.");
  215. if(PlayerArmour[playerid] + armour > 100) return SendClientMessage(playerid, COLOUR_GREY, "You may only have a maximum of 100 armour.");
  216. VehArmour[vehicleid] -= armour;
  217. PlayerArmour[playerid] += armour;
  218. SetPlayerArmour(playerid, PlayerArmour[playerid]);
  219. if(VehicleSQLID[vehicleid] > 0)
  220. {
  221. MySQL_SetFloat(vehicleid, "VehArmour", VehArmour[vehicleid], "vehicles");
  222. MySQL_SetFloat(PlayerSQLID[playerid], "Armour", PlayerArmour[playerid], "accounts");
  223. }
  224. format(string, sizeof(string), "You have taken %d of armour from the vehicle's trunk, there is now a total of: %d armour in the vehicle's trunk.", armour, floatround(VehArmour[vehicleid]));
  225. SendClientMessage(playerid, COLOUR_BLUE, string);
  226. format(string, sizeof(string), "* %s has taken some armour from the vehicle's trunk. *", GetNameEx(playerid));
  227. ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
  228. }
  229. }
  230. if(!strcmp(usage, "view", true))
  231. {
  232. new weaponamount, furniamount;
  233. for(new x = 1; x < MAX_WEAPONS; x++)
  234. {
  235. if(VehWepStored[x] == VehicleSQLID[vehicleid])
  236. {
  237. weaponamount ++;
  238. }
  239. if(VehFurniStored[x] == VehicleSQLID[vehicleid])
  240. {
  241. furniamount ++;
  242. }
  243. }
  244. //0xBCDE00FF
  245. //0x43B0FFFF
  246. SendClientMessage(playerid,0xFFD99FFF, "____________________Vehicle Trunk____________________");
  247. format(string, sizeof(string), "Money: {B0FFFF}$%s", AddCommas(VehCash[vehicleid]));
  248. SendClientMessage(playerid, 0xFFD99FFF, string);
  249. format(string, sizeof(string), "Armour: {B0FFFF}%d", floatround(VehArmour[vehicleid]));
  250. SendClientMessage(playerid, 0xFFD99FFF, string);
  251. format(string, sizeof(string), "Cocaine: {B0FFFF}%d gram(s)", VehCoke[vehicleid]);
  252. SendClientMessage(playerid, 0xFFD99FFF, string);
  253. format(string, sizeof(string), "Weed: {B0FFFF}%d gram(s)", VehWeed[vehicleid]);
  254. SendClientMessage(playerid, 0xFFD99FFF, string);
  255. format(string, sizeof(string), "Amount of weapons: {B0FFFF}%d. (Use /vgetwep to see what weapons are in the vehicle.)", weaponamount);
  256. SendClientMessage(playerid, 0xFFD99FFF, string);
  257. format(string, sizeof(string), "Amount of furniture: {B0FFFF}%d. (Use /vgetfurni to see what furniture is in the vehicle.)", furniamount);
  258. SendClientMessage(playerid, 0xFFD99FFF, string);
  259. SendClientMessage(playerid,0xFFD99FFF, "____________________Vehicle Trunk____________________");
  260. }
  261. if(!strcmp(usage, "weapons", true))
  262. {
  263. new amount = 0, string1[500], model = GetVehicleModel(vehicleid) - 400;
  264. for(new x = 1; x < MAX_WEAPONS; x++)
  265. {
  266. if(VehWepStored[x] == VehicleSQLID[vehicleid])
  267. {
  268. WeaponEnum[playerid][amount][wepid] = x;
  269. if(amount == 0 && WepSerial[x] == 0)
  270. {
  271. format(string1, sizeof(string1),"%s (%d Ammo) Serial: None.",WeaponNames[WepModel[x]], WepAmmo[x]);
  272. }
  273. if(amount == 0 && WepSerial[x] > 0)
  274. {
  275. format(string1, sizeof(string1),"%s (%d Ammo) Serial: %d",WeaponNames[WepModel[x]], WepAmmo[x], WepSerial[x]);
  276. }
  277. if(amount > 0)
  278. {
  279. if(WepSerial[x] > 0)
  280. {
  281. format(string1, sizeof(string1),"%s\n%s (%d Ammo) Serial: %d",string1, WeaponNames[WepModel[x]], WepAmmo[x], WepSerial[x]);
  282. }
  283. else
  284. {
  285. format(string1, sizeof(string1),"%s\n%s (%d Ammo) Serial: None.",string1, WeaponNames[WepModel[x]], WepAmmo[x]);
  286. }
  287.  
  288. }
  289. amount++;
  290. strcpy(Pdialogstring[playerid], string1, 500);
  291. }
  292. }
  293. if(amount == 0) return SendClientMessage(playerid, COLOUR_GREY, "There are no weapons in this vehicle.");
  294. format(string, sizeof(string), "%s Weapons", VehicleNames[model]);
  295. ShowPlayerDialog(playerid, DIALOG_SHOWWEP, DIALOG_STYLE_LIST, string, Pdialogstring[playerid],"Close", "");
  296. }
  297. }
  298. return 1;
  299. }
Advertisement
Add Comment
Please, Sign In to add comment