I have been trying to figure this out for a while now…
A player is able to purchase a weapon OK from weaponshop.
The DB is updated correctly and it shows in their loadout.
When they die esx_ambulancejob functions correctly and removes it.
The problem arises when they disconnect from the server and rejoin.
They join without any weapons but their loadout in the DB is correct…thus what happens is they can’t purchase a weapon because they already own it. The only way to fix this is to die and let esx_ambulancejob remove the phantom weapon.
So far I have a hunch that spawnmanger is the problem, as weapons are correctly added (esx_weaponshop) and removed (esx_ambulancejob).
I came across an interesting piece of code in esx_ambulancejob
if Config.RemoveWeaponsAfterRPDeath then
for i=1, #xPlayer.loadout, 1 do
xPlayer.removeWeapon(xPlayer.loadout[i].name)
end
else – save weapons & restore em’ since spawnmanager removes them
for i=1, #xPlayer.loadout, 1 do
table.insert(playerLoadout, xPlayer.loadout[i])
end
This “workaround” for spawnmanger makes me think this is happening as spawnmanger handles the player when connecting to the server.
Anyone have a similar problem or solution?