I don’t know, I’m not at home now so I can’t test, but if the original code work, no reason this one doesn’t work and I never use playerSpawned in my script…
I probably do something like that:
Citizen.CreateThread(function ()
while true do
Citizen.Wait(0)
if NetworkIsSessionStarted() then
local player = GetPlayerPed(-1)
local gadget = GetHashKey("GADGET_PARACHUTE")
SetPedGadget(player, gadget, 1, false)
return
end
end
end)
in resources[system]\spawnmanager\spawnmanager.lua
i put that code for test with snawball
AddEventHandler('playerSpawned', function(spawn)
local player = GetPlayerPed(-1)
local weapon = GetHashKey("weapon_snowball")
GiveWeaponToPed(player, weapon, 10, false)
end)
And it’s work, i have 10 snowball
For parachute i tried this code
AddEventHandler('playerSpawned', function(spawn)
local player = GetPlayerPed(-1)
local gadget = GetHashKey("gadget_parachute")
SetPedGadget(player, gadget, 1, false)
end)
But not work… i will try another time, thanks for help ! and if you find a solution tell me (it’s just a test)
So if i want to spawn a car i should do this? Where do i need to add coordinates of the vehicle?
Or maybe to spawn the ped inside of the vehicle?
AddEventHandler('playerSpawned', function(spawn)
local player = GetPlayerPed(-1)
local vehicle = GetHashKey("vehicle_sabregt")
SetPedVehicle(player, vehicle, 1, true)
end)
AddEventHandler('playerSpawned', function(spawn)
local player = GetPlayerPed(-1)
local vehicle = GetHashKey("sabregt")
local coords = GetOffsetFromEntityInWorldCoords(playerPed, 0, 5.0, 0)
local car = CreateVehicle(vehicle, coords, 0.0, true, false)
SetPedIntoVehicle(player, car, -1)
end)
This SHOULD work, again, i didn’t test it.
where did you get SetPedVehicle from? It doesn’t exist.
AddEventHandler('playerSpawned', function(spawn)
local player = GetPlayerPed(-1)
local gadget = GetHashKey("gadget_parachute")
SetPedGadget(player, gadget, true)
end)
not work (i put it in spawnmanager.lua like the code for the snowball) if you have idea ?