Oblivion_UFF

testing

Feb 8th, 2020
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.93 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. else if(!IsPlayerInAnyVehicle(playerid) && GetNearestVehicle(playerid) != INVALID_VEHICLE_ID)
  46. {
  47. id = GetNearestVehicle(playerid);
  48. new Float: vp[3];
  49. GetVehicleBoot(id, vp[0], vp[1], vp[2]);
  50.  
  51. if(!IsPlayerInRangeOfPoint(playerid, 2.5, vp[0], vp[1], vp[2]))
  52. return SendClientMessage(playerid, COLOR_YELLOW, "You aren't near the vehicles trunk.");
  53. }
  54.  
  55.  
  56. if(!IsValidFactionCar(id) && !IsValidPlayerCar(id))
  57. return SendClientMessage(playerid, COLOR_ADM, "SERVER: This command can only be used for private vehicles. You are in a public static vehicle.");
  58.  
  59. if(IsValidPlayerCar(id))
  60. {
  61. if(sscanf(params, "i", weapon_id))
  62. return SendClientMessage(playerid, COLOR_ADM, "USAGE: /place [weapon id]");
  63.  
  64. if(!PlayerHasWeapon(playerid, weapon_id))
  65. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have that weapon.");
  66.  
  67. slot_id = Car_ReturnWeaponSlot(id);
  68.  
  69. if(slot_id == -1)
  70. return SendClientMessage(playerid, COLOR_ADM, "ERROR: This vehicle is at full capacity.");
  71.  
  72. ammo = ReturnWeaponAmmo(playerid, weapon_id);
  73.  
  74. if(SlotBeingUsed[id][slot_id])
  75. return SendClientMessage(playerid, COLOR_ADM, "You can't place your weapon there right now.");
  76.  
  77. PlayerPlacingWeapon[playerid] = 1;
  78. PlayerPlacingWeaponSlot[playerid] = slot_id;
  79.  
  80. PlayerPlacingWeaponID[playerid] = weapon_id;
  81. PlayerPlacingWeaponAmmo[playerid] = ammo;
  82.  
  83. SlotBeingUsed[id][slot_id] = 1;
  84. PlayerPlacingInVehicle[playerid] = id;
  85. PlayerData[playerid][ptrynadupe] = true;
  86. new
  87. Float:x[3];
  88. GetPlayerPos(playerid, x[0], x[1], x[2]);
  89.  
  90. 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));
  91. EditDynamicObject(playerid, CarData[id][carWeaponObject][slot_id]);
  92. printf("weapon removed from player");
  93. SendClientMessage(playerid, COLOR_ADM, "INFO: Hold {FFFFFF}W{FF6347} or {FFFFFF}SPACE{FF6347} to move your camera.");
  94. Message(playerid, COLOR_YELLOW, "You're storing a %s with %i Ammo.", ReturnWeaponName(weapon_id), ammo);
  95. RemovePlayerWeapon(playerid, weapon_id);
  96. return 1;
  97.  
  98. }
  99.  
  100. if(IsValidFactionCar(id) && FactionData[FactionCar[id][carFaction]][factionCopPerms])
  101. {
  102. if(sscanf(params, "i", weapon_id))
  103. return SendClientMessage(playerid, COLOR_ADM, "USAGE: /place [weapon id]");
  104.  
  105. if(weapon_id != 25 && weapon_id != 29 && weapon_id != 27 && weapon_id != 31 && weapon_id != 34 && weapon_id != 41 && weapon_id != 43)
  106. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You can't put that in this car.");
  107.  
  108. switch(weapon_id)
  109. {
  110. case 25:
  111. {
  112. if(!PlayerHasWeapon(playerid, 25) && !IsSaveableWeapon(playerid, 25))
  113. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
  114.  
  115. TakePlayerWeapon(playerid, 25);
  116.  
  117. format(string, sizeof(string), "* %s places their Shotgun 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 29:
  122. {
  123. if(!PlayerHasWeapon(playerid, 29) && !IsSaveableWeapon(playerid, 29))
  124. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
  125.  
  126. TakePlayerWeapon(playerid, 29);
  127.  
  128. format(string, sizeof(string), "* %s places their MP5 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 31:
  133. {
  134. if(!PlayerHasWeapon(playerid, 31) && !IsSaveableWeapon(playerid, 31))
  135. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
  136.  
  137. TakePlayerWeapon(playerid, 31);
  138.  
  139. format(string, sizeof(string), "* %s places their M4 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 34:
  144. {
  145. if(!PlayerHasWeapon(playerid, 34) && !IsSaveableWeapon(playerid, 34))
  146. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
  147.  
  148. TakePlayerWeapon(playerid, 34);
  149.  
  150. format(string, sizeof(string), "* %s places their Sniper Rifle 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 41:
  155. {
  156. if(!PlayerHasWeapon(playerid, 41) && !IsSaveableWeapon(playerid, 41))
  157. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
  158.  
  159. TakePlayerWeapon(playerid, 41);
  160.  
  161. format(string, sizeof(string), "* %s places their Spray Can 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. case 43:
  166. {
  167. if(!PlayerHasWeapon(playerid, 45) && !IsSaveableWeapon(playerid, 45))
  168. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
  169.  
  170. TakePlayerWeapon(playerid, 45);
  171.  
  172. format(string, sizeof(string), "* %s places their Camera in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
  173. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  174. SendClientMessage(playerid, COLOR_EMOTE, string);
  175. }
  176. }
  177. return 1;
  178. }
  179. }
  180. SendClientMessage(playerid, COLOR_ADM, "SERVER: You can't place your weapon anywhere.");
  181. return 1;
  182. }
Advertisement
Add Comment
Please, Sign In to add comment