Hello,
How remove weapon in police car ?
Hello,
How remove weapon in police car ?
I don’t know if there is a script way to do this, but in vehicles.meta, there is a section with the “rewards” you get for entering the car.
<Item>
<modelName>police</modelName>
<txdName>police</txdName>
<handlingId>POLICE</handlingId>
<gameName>POLICE</gameName>
...
<rewards>
<Item>REWARD_WEAPON_PUMPSHOTGUN</Item>
<Item>REWARD_AMMO_PUMPSHOTGUN_ENTER_VEHICLE</Item>
<Item>REWARD_STAT_WEAPON</Item>
</rewards>
...
</Item>
In order to remove these rewards, you need to replace the whole <rewards></rewards>
section with <rewards />
.
You can copy all police car from original vehicles.meta to a new one, replace the sections and stream it via your server.
Where is the original file?
Use OpenIV to extract it :
Grand Theft Auto V\update\update.rpf\common\data\levels\gta5\vehicles.meta
You’ll have to be carreful parsing this file, it’s quite huge and if you forget to close a single section, your client game will crash on joining the server.
Did this work for you @samas92i ?
I tried it and it still give me a weapon in Sheriff2 (using for EMS Supervisor Vehicle).
I am streaming my own Vehicles.meta file with the above changes implemented however I still get a Carbine.
Any ideas?
I tried doing the vehicles.meta thing with no luck. However, I did find this native DISABLE_PLAYER_VEHICLE_REWARDS(Player player). Might be worth a shot. I’ll test it out and edit this post.
Edit: Eh… no luck with it. We could try just checking to see if the player exits a vehicle and have the script remove the weapon on exit.
Hello, you have a solution ?
My bad, that’s weird it’s working to add rewards on vehicles (I’ve tested it) and I assumed it would work to remove the reward but it doesn’t
Did you delete your cache before trying ?
Yup, I’ve added a line to remove the cache folder in run.bat
to avoid any problem.
Any solution on this problem? please help.
Hi,
I manage this point by memorizing player’s loadout (weapons + ammo) and by comparing it with the loadout of the player when he leave the car. This is not perfect but I did not found any other solution for now…
The zc_Player.player.loadout
is updated with the “zc_Player.getLoadout()
” method when player deals with weapons.
local newLoadout = zc_Player.getLoadout()
for i in pairs(newLoadout) do
if newLoadout[i].hash ~= 0 then
if zc_Player.player.loadout[newLoadout[i].hash] == nil then
RemoveWeaponFromPed(ped, newLoadout[i].hash)
SetPedAmmo(ped, newLoadout[i].hash, 0)
elseif newLoadout[i].ammo > zc_Player.player.loadout[newLoadout[i].hash].ammo then
SetPedAmmo(ped, newLoadout[i].hash, zc_Player.player.loadout[newLoadout[i].hash].ammo)
end
end
end
Function/Method to get player loadout :
-- Get loadout
function zc_Player.getLoadout()
local ped = GetPlayerPed(-1)
local loadout = {}
for i=1,38 do
local weapon_id = GetPedWeapontypeInSlot(ped, zc_Config.slots[i])
loadout[i] = {
weapon_id = weapon_id,
ammo = GetAmmoInPedWeapon(ped, weapon_id)
}
end
return loadout
end
And the slot list
zc_Config.slots = {
1993361168,
1277010230,
932043479,
690654591,
1459198205,
195782970,
-438797331,
896793492,
495159329,
-1155528315,
-515636489,
-871913299,
-1352759032,
-542958961,
1682645887,
-859470162,
-2125426402,
2067210266,
-538172856,
1783244476,
439844898,
-24829327,
1949306232,
-1941230881,
-1033554448,
320513715,
-695165975,
-281028447,
-686713772,
347509793,
1769089473,
189935548,
248801358,
386596758,
-157212362,
436985596,
-47957369,
575938238
}
Hope it’ll help
His walk with the last update
It works? The .meta or the native?
native function and maybe .meta
Has anyone solved the problem of pulling weapons out of police cars by players?
I need help, I wanted to know when you confiscated
Do the guns of a dead man continue with him, when the ambulance revives or uses the / revive??
Hello, I found the solution, just install this script and voila, solved.
https://forum.cfx.re/uploads/default/original/3X/e/6/e6401ee6198708f5888b5b7c081770eb4828cf55.rar