Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMD:place(playerid, params[])
- {
- new
- string[128],
- id,
- slot_id,
- weapon_id,
- ammo
- ;
- if((id = IsPlayerInProperty(playerid)) != 0)
- {
- if(!IsPlayerInRangeOfPoint(playerid, 4.0, PropertyData[id][propertyCheckPos][0], PropertyData[id][propertyCheckPos][1], PropertyData[id][propertyCheckPos][2]))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You aren't near the command spot.");
- if(GetPlayerWeapon(playerid) == 0)
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You aren't holding your weapon.");
- weapon_id = ReturnWeapon(playerid);
- if(weapon_id == -1)
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You aren't holding a weapon.");
- ammo = ReturnWeaponAmmo(playerid, weapon_id);
- slot_id = House_ReturnWeaponSlot(id);
- PropertyData[id][propertyWeapons][slot_id] = weapon_id;
- PropertyData[id][propertyAmmo][slot_id] = ammo;
- TakePlayerWeapon(playerid, weapon_id);
- SaveProperty(id);
- format(string, sizeof(string), "* %s stores a %s in the house.", ReturnName(playerid, 0), ReturnWeaponName(weapon_id));
- SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
- SendClientMessage(playerid, COLOR_EMOTE, string);
- 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);
- return 1;
- }
- if(IsPlayerInAnyVehicle(playerid))
- {
- id = GetPlayerVehicleID(playerid);
- if(!IsValidFactionCar(id) && !IsValidPlayerCar(id))
- return SendClientMessage(playerid, COLOR_ADM, "SERVER: This command can only be used for private vehicles. You are in a public static vehicle.");
- if(IsValidPlayerCar(id))
- {
- if(sscanf(params, "i", weapon_id))
- return SendClientMessage(playerid, COLOR_ADM, "USAGE: /place [weapon id]");
- if(!PlayerHasWeapon(playerid, weapon_id))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have that weapon.");
- slot_id = Car_ReturnWeaponSlot(id);
- if(slot_id == -1)
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: This vehicle is at full capacity.");
- ammo = ReturnWeaponAmmo(playerid, weapon_id);
- if(SlotBeingUsed[id][slot_id])
- return SendClientMessage(playerid, COLOR_ADM, "You can't place your weapon there right now.");
- PlayerPlacingWeapon[playerid] = 1;
- PlayerPlacingWeaponSlot[playerid] = slot_id;
- PlayerPlacingWeaponID[playerid] = weapon_id;
- PlayerPlacingWeaponAmmo[playerid] = ammo;
- SlotBeingUsed[id][slot_id] = 1;
- PlayerPlacingInVehicle[playerid] = id;
- PlayerData[playerid][ptrynadupe] = true;
- new
- Float:x[3];
- GetPlayerPos(playerid, x[0], x[1], x[2]);
- 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));
- EditDynamicObject(playerid, CarData[id][carWeaponObject][slot_id]);
- printf("weapon removed from player");
- SendClientMessage(playerid, COLOR_ADM, "INFO: Hold {FFFFFF}W{FF6347} or {FFFFFF}SPACE{FF6347} to move your camera.");
- Message(playerid, COLOR_YELLOW, "You're storing a %s with %i Ammo.", ReturnWeaponName(weapon_id), ammo);
- RemovePlayerWeapon(playerid, weapon_id);
- return 1;
- }
- if(IsValidFactionCar(id) && FactionData[FactionCar[id][carFaction]][factionCopPerms])
- {
- if(sscanf(params, "i", weapon_id))
- return SendClientMessage(playerid, COLOR_ADM, "USAGE: /place [weapon id]");
- if(weapon_id != 25 && weapon_id != 29 && weapon_id != 27 && weapon_id != 31 && weapon_id != 34 && weapon_id != 41 && weapon_id != 43)
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You can't put that in this car.");
- switch(weapon_id)
- {
- case 25:
- {
- if(!PlayerHasWeapon(playerid, 25) && !IsSaveableWeapon(playerid, 25))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
- TakePlayerWeapon(playerid, 25);
- format(string, sizeof(string), "* %s places their Shotgun in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
- SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
- SendClientMessage(playerid, COLOR_EMOTE, string);
- }
- case 29:
- {
- if(!PlayerHasWeapon(playerid, 29) && !IsSaveableWeapon(playerid, 29))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
- TakePlayerWeapon(playerid, 29);
- format(string, sizeof(string), "* %s places their MP5 in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
- SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
- SendClientMessage(playerid, COLOR_EMOTE, string);
- }
- case 31:
- {
- if(!PlayerHasWeapon(playerid, 31) && !IsSaveableWeapon(playerid, 31))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
- TakePlayerWeapon(playerid, 31);
- format(string, sizeof(string), "* %s places their M4 in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
- SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
- SendClientMessage(playerid, COLOR_EMOTE, string);
- }
- case 34:
- {
- if(!PlayerHasWeapon(playerid, 34) && !IsSaveableWeapon(playerid, 34))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
- TakePlayerWeapon(playerid, 34);
- format(string, sizeof(string), "* %s places their Sniper Rifle in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
- SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
- SendClientMessage(playerid, COLOR_EMOTE, string);
- }
- case 41:
- {
- if(!PlayerHasWeapon(playerid, 41) && !IsSaveableWeapon(playerid, 41))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
- TakePlayerWeapon(playerid, 41);
- format(string, sizeof(string), "* %s places their Spray Can in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
- SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
- SendClientMessage(playerid, COLOR_EMOTE, string);
- }
- case 43:
- {
- if(!PlayerHasWeapon(playerid, 45) && !IsSaveableWeapon(playerid, 45))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
- TakePlayerWeapon(playerid, 45);
- format(string, sizeof(string), "* %s places their Camera in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
- SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
- SendClientMessage(playerid, COLOR_EMOTE, string);
- }
- }
- return 1;
- }
- }
- else if(IsPlayerInAnyVehicle(playerid) || GetNearestVehicle(playerid) != INVALID_VEHICLE_ID)
- {
- id = GetNearestVehicle(playerid);
- GetVehicleBoot(id, x, y, z);
- if(!IsValidFactionCar(id) && !IsValidPlayerCar(id))
- return SendClientMessage(playerid, COLOR_ADM, "SERVER: This command can only be used for private vehicles. You are in a public static vehicle.");
- if(!IsPlayerInRangeOfPoint(playerid, 2.5, x, y, z))
- return SendClientMessage(playerid, COLOR_YELLOW, "You aren't near the vehicles trunk.");
- if(IsValidPlayerCar(id))
- {
- if(sscanf(params, "i", weapon_id))
- return SendClientMessage(playerid, COLOR_ADM, "USAGE: /place [weapon id]");
- if(!PlayerHasWeapon(playerid, weapon_id))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have that weapon.");
- slot_id = Car_ReturnWeaponSlot(id);
- if(slot_id == -1)
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: This vehicle is at full capacity.");
- ammo = ReturnWeaponAmmo(playerid, weapon_id);
- if(SlotBeingUsed[id][slot_id])
- return SendClientMessage(playerid, COLOR_ADM, "You can't place your weapon there right now.");
- PlayerPlacingWeapon[playerid] = 1;
- PlayerPlacingWeaponSlot[playerid] = slot_id;
- PlayerPlacingWeaponID[playerid] = weapon_id;
- PlayerPlacingWeaponAmmo[playerid] = ammo;
- SlotBeingUsed[id][slot_id] = 1;
- PlayerPlacingInVehicle[playerid] = id;
- PlayerData[playerid][ptrynadupe] = true;
- new
- Float:x[3];
- GetPlayerPos(playerid, x[0], x[1], x[2]);
- 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));
- EditDynamicObject(playerid, CarData[id][carWeaponObject][slot_id]);
- printf("weapon removed from player");
- SendClientMessage(playerid, COLOR_ADM, "INFO: Hold {FFFFFF}W{FF6347} or {FFFFFF}SPACE{FF6347} to move your camera.");
- Message(playerid, COLOR_YELLOW, "You're storing a %s with %i Ammo.", ReturnWeaponName(weapon_id), ammo);
- RemovePlayerWeapon(playerid, weapon_id);
- return 1;
- }
- if(IsValidFactionCar(id) && FactionData[FactionCar[id][carFaction]][factionCopPerms])
- {
- if(sscanf(params, "i", weapon_id))
- return SendClientMessage(playerid, COLOR_ADM, "USAGE: /place [weapon id]");
- if(weapon_id != 25 && weapon_id != 29 && weapon_id != 27 && weapon_id != 31 && weapon_id != 34 && weapon_id != 41 && weapon_id != 43)
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You can't put that in this car.");
- switch(weapon_id)
- {
- case 25:
- {
- if(!PlayerHasWeapon(playerid, 25) && !IsSaveableWeapon(playerid, 25))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
- TakePlayerWeapon(playerid, 25);
- format(string, sizeof(string), "* %s places their Shotgun in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
- SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
- SendClientMessage(playerid, COLOR_EMOTE, string);
- }
- case 29:
- {
- if(!PlayerHasWeapon(playerid, 29) && !IsSaveableWeapon(playerid, 29))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
- TakePlayerWeapon(playerid, 29);
- format(string, sizeof(string), "* %s places their MP5 in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
- SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
- SendClientMessage(playerid, COLOR_EMOTE, string);
- }
- case 31:
- {
- if(!PlayerHasWeapon(playerid, 31) && !IsSaveableWeapon(playerid, 31))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
- TakePlayerWeapon(playerid, 31);
- format(string, sizeof(string), "* %s places their M4 in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
- SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
- SendClientMessage(playerid, COLOR_EMOTE, string);
- }
- case 34:
- {
- if(!PlayerHasWeapon(playerid, 34) && !IsSaveableWeapon(playerid, 34))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
- TakePlayerWeapon(playerid, 34);
- format(string, sizeof(string), "* %s places their Sniper Rifle in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
- SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
- SendClientMessage(playerid, COLOR_EMOTE, string);
- }
- case 41:
- {
- if(!PlayerHasWeapon(playerid, 41) && !IsSaveableWeapon(playerid, 41))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
- TakePlayerWeapon(playerid, 41);
- format(string, sizeof(string), "* %s places their Spray Can in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
- SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
- SendClientMessage(playerid, COLOR_EMOTE, string);
- }
- case 43:
- {
- if(!PlayerHasWeapon(playerid, 45) && !IsSaveableWeapon(playerid, 45))
- return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
- TakePlayerWeapon(playerid, 45);
- format(string, sizeof(string), "* %s places their Camera in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
- SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
- SendClientMessage(playerid, COLOR_EMOTE, string);
- }
- }
- return 1;
- }
- }
- SendClientMessage(playerid, COLOR_ADM, "SERVER: You can't place your weapon anywhere.");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment