Hey !
Ok i have the weapon shop system. When the server restart, the player have his weapon but no ammo. Do you have a simply line to solve this ? Thx <3
little update I didn t find issue, when my cop spawn, they don t have ammo
Hello guys, how to remove guns when the player die, because he always keep them after death and reonnect?
Hello, to remove weapons of a player you can use :
All weapons :
RemoveAllPedWeapons (GetPlayerPed(-1), true)
or specific weapons
RemoveWeaponFromPed (GetPlayerPed(-1), WeaponHash)
Oh thanks but where im gonna supposed to write this code and it will remove the weapons just at death?
You must create an event - eg :
Citizen.CreateThread(function()
while true do
Wait(0)
if IsEntityDead(GetPlayerPed(-1)) then
RemoveAllPedWeapons(GetPlayerPed(-1), true)
end
end
end)
If you want the player to respawn at hospital you can use :
Citizen.CreateThread(function()
while true do
Wait(0)
if IsEntityDead(GetPlayerPed(-1)) then
Wait(15000) -- Time until respawn 15s
NetworkResurrectLocalPlayer(295.83, -1446.94, 29.97, true, true, false)
RemoveAllPedWeapons(GetPlayerPed(-1), true)
ClearPedBloodDamage(GetPlayerPed(-1))
ClearPedLastDamageBone(GetPlayerPed(-1))
ClearPedTasks(GetPlayerPed(-1))
end
end
end)
Oh thanks ! You put this on the weashop.lua ?
If you do a respawn point in hospital, you need to remove the other respawn point ? This will not cause multiple respawn issue ?
Only if you have already configured a NetworkResurrectLocalPlayer