[HELP]Magazine on Spwan


#1

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


#2

little update I didn t find issue, when my cop spawn, they don t have ammo


#3

Hello guys, how to remove guns when the player die, because he always keep them after death and reonnect?


#4

Hello, to remove weapons of a player you can use :

All weapons :

RemoveAllPedWeapons (GetPlayerPed(-1), true)

or specific weapons

 RemoveWeaponFromPed (GetPlayerPed(-1), WeaponHash)

#5

Oh thanks but where im gonna supposed to write this code and it will remove the weapons just at death?


#6

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)

[Release][ES] Weapon Store [v1.1]
#7

Oh thanks ! You put this on the weashop.lua ?


#8

If you do a respawn point in hospital, you need to remove the other respawn point ? This will not cause multiple respawn issue ?


#9

Only if you have already configured a NetworkResurrectLocalPlayer