Hi,
I try to create weapon at specific point on the map, all look work but no weapon on the map… there is my code, any idea?
local x = 1
Citizen.CreateThread(function()
Citizen.Wait(0)
while not weaponPlaced do
-- RemoveAllPedWeapons(GetPlayerPed(-1), true)
weaponPlace = weaponCoords[x]
--weaponNum = GetRandomIntInRange(1, #weaponsList)
givenWeapon = weaponsList[GetRandomIntInRange(1, #weaponsList)]
while not HasModelLoaded(GetHashKey(givenWeapon)) do
Citizen.Wait(0)
end
--weaponHash = GetHashKey(givenWeapon)
weapon = CreatePickupRotate(GetHashKey(givenWeapon), weaponPlace[1], weaponPlace[2], weaponPlace[3], 0.0, 0.0, 0.0, 8, 1.0, 24, 24, true, GetHashKey(givenWeapon))
--CreateWeaponObject(weaponHash, 10, weaponPlace[1], weaponPlace[2], weaponPlace[3], true, 220.20, 1)
SetEntityDynamic(weapon, true)
SetEntityRecordsCollisions(weapon, true)
SetEntityHasGravity(weapon, true)
FreezeEntityPosition(weapon, false)
SetEntityVelocity(weapon, 0.0, 0.0, -0.2)
x = x + 1
TriggerEvent('chatMessage', '', { 0, 0, 0 }, 'Weapon: '..givenWeapon)
if x == #weaponCoords then
weaponPlaced = true
end
end
end)
As you can see, I try a lok of stuff, nothing work… I have the message “Weapon: WEAPON_NAME” for each “x” but no weapon on map…
Thanks for your help!