Oblivion_UFF

bablabla

Feb 8th, 2020
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.53 KB | None | 0 0
  1. CMD:place(playerid, params[])
  2. {
  3. new
  4. string[128],
  5. id,
  6. slot_id,
  7. weapon_id,
  8. ammo
  9. ;
  10.  
  11. if((id = IsPlayerInProperty(playerid)) != 0)
  12. {
  13. if(!IsPlayerInRangeOfPoint(playerid, 4.0, PropertyData[id][propertyCheckPos][0], PropertyData[id][propertyCheckPos][1], PropertyData[id][propertyCheckPos][2]))
  14. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You aren't near the command spot.");
  15.  
  16. if(GetPlayerWeapon(playerid) == 0)
  17. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You aren't holding your weapon.");
  18.  
  19. weapon_id = ReturnWeapon(playerid);
  20.  
  21. if(weapon_id == -1)
  22. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You aren't holding a weapon.");
  23.  
  24. ammo = ReturnWeaponAmmo(playerid, weapon_id);
  25. slot_id = House_ReturnWeaponSlot(id);
  26.  
  27. PropertyData[id][propertyWeapons][slot_id] = weapon_id;
  28. PropertyData[id][propertyAmmo][slot_id] = ammo;
  29.  
  30. TakePlayerWeapon(playerid, weapon_id);
  31. SaveProperty(id);
  32.  
  33. format(string, sizeof(string), "* %s stores a %s in the house.", ReturnName(playerid, 0), ReturnWeaponName(weapon_id));
  34. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  35. SendClientMessage(playerid, COLOR_EMOTE, string);
  36.  
  37. WriteLog("weapon_logs/property_place.txt", "[%s] %s (DBID: %i) placed %s (Ammo: %i) in Property %i", ReturnDate(), ReturnName(playerid), PlayerData[playerid][pSQLID], ReturnWeaponName(weapon_id), ammo, id);
  38. return 1;
  39. }
  40.  
  41. if(IsPlayerInAnyVehicle(playerid))
  42. {
  43. id = GetPlayerVehicleID(playerid);
  44.  
  45. if(!IsValidFactionCar(id) && !IsValidPlayerCar(id))
  46. return SendClientMessage(playerid, COLOR_ADM, "SERVER: This command can only be used for private vehicles. You are in a public static vehicle.");
  47.  
  48. if(IsValidPlayerCar(id))
  49. {
  50. if(sscanf(params, "i", weapon_id))
  51. return SendClientMessage(playerid, COLOR_ADM, "USAGE: /place [weapon id]");
  52.  
  53. if(!PlayerHasWeapon(playerid, weapon_id))
  54. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have that weapon.");
  55.  
  56. slot_id = Car_ReturnWeaponSlot(id);
  57.  
  58. if(slot_id == -1)
  59. return SendClientMessage(playerid, COLOR_ADM, "ERROR: This vehicle is at full capacity.");
  60.  
  61. ammo = ReturnWeaponAmmo(playerid, weapon_id);
  62.  
  63. if(SlotBeingUsed[id][slot_id])
  64. return SendClientMessage(playerid, COLOR_ADM, "You can't place your weapon there right now.");
  65.  
  66. PlayerPlacingWeapon[playerid] = 1;
  67. PlayerPlacingWeaponSlot[playerid] = slot_id;
  68.  
  69. PlayerPlacingWeaponID[playerid] = weapon_id;
  70. PlayerPlacingWeaponAmmo[playerid] = ammo;
  71.  
  72. SlotBeingUsed[id][slot_id] = 1;
  73. PlayerPlacingInVehicle[playerid] = id;
  74. PlayerData[playerid][ptrynadupe] = true;
  75. new
  76. Float:x[3];
  77. GetPlayerPos(playerid, x[0], x[1], x[2]);
  78.  
  79. CarData[id][carWeaponObject][slot_id] = CreateDynamicObject(ReturnWeaponsModel(weapon_id), x[0], x[1], x[2], 80.0, 0.0, 0.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
  80. EditDynamicObject(playerid, CarData[id][carWeaponObject][slot_id]);
  81. printf("weapon removed from player");
  82. SendClientMessage(playerid, COLOR_ADM, "INFO: Hold {FFFFFF}W{FF6347} or {FFFFFF}SPACE{FF6347} to move your camera.");
  83. Message(playerid, COLOR_YELLOW, "You're storing a %s with %i Ammo.", ReturnWeaponName(weapon_id), ammo);
  84. RemovePlayerWeapon(playerid, weapon_id);
  85. return 1;
  86.  
  87. }
  88.  
  89. if(IsValidFactionCar(id) && FactionData[FactionCar[id][carFaction]][factionCopPerms])
  90. {
  91. if(sscanf(params, "i", weapon_id))
  92. return SendClientMessage(playerid, COLOR_ADM, "USAGE: /place [weapon id]");
  93.  
  94. if(weapon_id != 25 && weapon_id != 29 && weapon_id != 27 && weapon_id != 31 && weapon_id != 34 && weapon_id != 41 && weapon_id != 43)
  95. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You can't put that in this car.");
  96.  
  97. switch(weapon_id)
  98. {
  99. case 25:
  100. {
  101. if(!PlayerHasWeapon(playerid, 25) && !IsSaveableWeapon(playerid, 25))
  102. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
  103.  
  104. TakePlayerWeapon(playerid, 25);
  105.  
  106. format(string, sizeof(string), "* %s places their Shotgun in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
  107. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  108. SendClientMessage(playerid, COLOR_EMOTE, string);
  109. }
  110. case 29:
  111. {
  112. if(!PlayerHasWeapon(playerid, 29) && !IsSaveableWeapon(playerid, 29))
  113. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
  114.  
  115. TakePlayerWeapon(playerid, 29);
  116.  
  117. format(string, sizeof(string), "* %s places their MP5 in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
  118. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  119. SendClientMessage(playerid, COLOR_EMOTE, string);
  120. }
  121. case 31:
  122. {
  123. if(!PlayerHasWeapon(playerid, 31) && !IsSaveableWeapon(playerid, 31))
  124. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
  125.  
  126. TakePlayerWeapon(playerid, 31);
  127.  
  128. format(string, sizeof(string), "* %s places their M4 in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
  129. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  130. SendClientMessage(playerid, COLOR_EMOTE, string);
  131. }
  132. case 34:
  133. {
  134. if(!PlayerHasWeapon(playerid, 34) && !IsSaveableWeapon(playerid, 34))
  135. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
  136.  
  137. TakePlayerWeapon(playerid, 34);
  138.  
  139. format(string, sizeof(string), "* %s places their Sniper Rifle in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
  140. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  141. SendClientMessage(playerid, COLOR_EMOTE, string);
  142. }
  143. case 41:
  144. {
  145. if(!PlayerHasWeapon(playerid, 41) && !IsSaveableWeapon(playerid, 41))
  146. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
  147.  
  148. TakePlayerWeapon(playerid, 41);
  149.  
  150. format(string, sizeof(string), "* %s places their Spray Can in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
  151. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  152. SendClientMessage(playerid, COLOR_EMOTE, string);
  153. }
  154. case 43:
  155. {
  156. if(!PlayerHasWeapon(playerid, 45) && !IsSaveableWeapon(playerid, 45))
  157. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
  158.  
  159. TakePlayerWeapon(playerid, 45);
  160.  
  161. format(string, sizeof(string), "* %s places their Camera in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
  162. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  163. SendClientMessage(playerid, COLOR_EMOTE, string);
  164. }
  165. }
  166. return 1;
  167. }
  168. }
  169. else if(IsPlayerInAnyVehicle(playerid) || GetNearestVehicle(playerid) != INVALID_VEHICLE_ID)
  170. {
  171. id = GetNearestVehicle(playerid);
  172.  
  173. GetVehicleBoot(id, x, y, z);
  174.  
  175. if(!IsValidFactionCar(id) && !IsValidPlayerCar(id))
  176. return SendClientMessage(playerid, COLOR_ADM, "SERVER: This command can only be used for private vehicles. You are in a public static vehicle.");
  177. if(!IsPlayerInRangeOfPoint(playerid, 2.5, x, y, z))
  178. return SendClientMessage(playerid, COLOR_YELLOW, "You aren't near the vehicles trunk.");
  179. if(IsValidPlayerCar(id))
  180. {
  181. if(sscanf(params, "i", weapon_id))
  182. return SendClientMessage(playerid, COLOR_ADM, "USAGE: /place [weapon id]");
  183.  
  184. if(!PlayerHasWeapon(playerid, weapon_id))
  185. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have that weapon.");
  186.  
  187. slot_id = Car_ReturnWeaponSlot(id);
  188.  
  189. if(slot_id == -1)
  190. return SendClientMessage(playerid, COLOR_ADM, "ERROR: This vehicle is at full capacity.");
  191.  
  192. ammo = ReturnWeaponAmmo(playerid, weapon_id);
  193.  
  194. if(SlotBeingUsed[id][slot_id])
  195. return SendClientMessage(playerid, COLOR_ADM, "You can't place your weapon there right now.");
  196.  
  197. PlayerPlacingWeapon[playerid] = 1;
  198. PlayerPlacingWeaponSlot[playerid] = slot_id;
  199.  
  200. PlayerPlacingWeaponID[playerid] = weapon_id;
  201. PlayerPlacingWeaponAmmo[playerid] = ammo;
  202.  
  203. SlotBeingUsed[id][slot_id] = 1;
  204. PlayerPlacingInVehicle[playerid] = id;
  205. PlayerData[playerid][ptrynadupe] = true;
  206. new
  207. Float:x[3];
  208. GetPlayerPos(playerid, x[0], x[1], x[2]);
  209.  
  210. CarData[id][carWeaponObject][slot_id] = CreateDynamicObject(ReturnWeaponsModel(weapon_id), x[0], x[1], x[2], 80.0, 0.0, 0.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
  211. EditDynamicObject(playerid, CarData[id][carWeaponObject][slot_id]);
  212. printf("weapon removed from player");
  213. SendClientMessage(playerid, COLOR_ADM, "INFO: Hold {FFFFFF}W{FF6347} or {FFFFFF}SPACE{FF6347} to move your camera.");
  214. Message(playerid, COLOR_YELLOW, "You're storing a %s with %i Ammo.", ReturnWeaponName(weapon_id), ammo);
  215. RemovePlayerWeapon(playerid, weapon_id);
  216. return 1;
  217.  
  218. }
  219.  
  220. if(IsValidFactionCar(id) && FactionData[FactionCar[id][carFaction]][factionCopPerms])
  221. {
  222. if(sscanf(params, "i", weapon_id))
  223. return SendClientMessage(playerid, COLOR_ADM, "USAGE: /place [weapon id]");
  224.  
  225. if(weapon_id != 25 && weapon_id != 29 && weapon_id != 27 && weapon_id != 31 && weapon_id != 34 && weapon_id != 41 && weapon_id != 43)
  226. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You can't put that in this car.");
  227.  
  228. switch(weapon_id)
  229. {
  230. case 25:
  231. {
  232. if(!PlayerHasWeapon(playerid, 25) && !IsSaveableWeapon(playerid, 25))
  233. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
  234.  
  235. TakePlayerWeapon(playerid, 25);
  236.  
  237. format(string, sizeof(string), "* %s places their Shotgun in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
  238. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  239. SendClientMessage(playerid, COLOR_EMOTE, string);
  240. }
  241. case 29:
  242. {
  243. if(!PlayerHasWeapon(playerid, 29) && !IsSaveableWeapon(playerid, 29))
  244. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
  245.  
  246. TakePlayerWeapon(playerid, 29);
  247.  
  248. format(string, sizeof(string), "* %s places their MP5 in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
  249. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  250. SendClientMessage(playerid, COLOR_EMOTE, string);
  251. }
  252. case 31:
  253. {
  254. if(!PlayerHasWeapon(playerid, 31) && !IsSaveableWeapon(playerid, 31))
  255. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
  256.  
  257. TakePlayerWeapon(playerid, 31);
  258.  
  259. format(string, sizeof(string), "* %s places their M4 in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
  260. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  261. SendClientMessage(playerid, COLOR_EMOTE, string);
  262. }
  263. case 34:
  264. {
  265. if(!PlayerHasWeapon(playerid, 34) && !IsSaveableWeapon(playerid, 34))
  266. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
  267.  
  268. TakePlayerWeapon(playerid, 34);
  269.  
  270. format(string, sizeof(string), "* %s places their Sniper Rifle in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
  271. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  272. SendClientMessage(playerid, COLOR_EMOTE, string);
  273. }
  274. case 41:
  275. {
  276. if(!PlayerHasWeapon(playerid, 41) && !IsSaveableWeapon(playerid, 41))
  277. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
  278.  
  279. TakePlayerWeapon(playerid, 41);
  280.  
  281. format(string, sizeof(string), "* %s places their Spray Can in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
  282. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  283. SendClientMessage(playerid, COLOR_EMOTE, string);
  284. }
  285. case 43:
  286. {
  287. if(!PlayerHasWeapon(playerid, 45) && !IsSaveableWeapon(playerid, 45))
  288. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
  289.  
  290. TakePlayerWeapon(playerid, 45);
  291.  
  292. format(string, sizeof(string), "* %s places their Camera in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
  293. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  294. SendClientMessage(playerid, COLOR_EMOTE, string);
  295. }
  296. }
  297. return 1;
  298. }
  299. }
  300. SendClientMessage(playerid, COLOR_ADM, "SERVER: You can't place your weapon anywhere.");
  301. return 1;
  302. }
Advertisement
Add Comment
Please, Sign In to add comment