I’m trying to figure out if there’s a way to give players items when they spawn. I’ve tried digging through the tutorials/wiki but I can’t seem to figure it out. Anyone have any scripts already pre-made or can lead me in the right direction?
Example: Player spawns in with Pistol/ammo on login/load from death.
@epbort My idea is that (Similar to some Arma 3 servers) a player would spawn in very high up, across several possible points in the map, with a parachute and pistol. So far I’m not making that great of progress so if anyone could contribute, that would be great.
Has anyone figured out a comfortable syntax for this in Lua? I am looking to spawn players in my server with some weapons, and if possible a motorcycle next to them, every time they respawn.
AddEventHandler('playerSpawned', function(spawn)
local player = GetPlayerPed(-1)
local weapon = GetHashKey("weapon_snowball")
GiveWeaponToPed(player, weapon, 10, false)
end)
Made this up real quick, this gives 10 snowballs to the player when spawning.
AddEventHandler('playerSpawned', function(spawn)
local player = GetPlayerPed(-1)
local weapon = GetHashKey("weapon_snowball")
GiveWeaponToPed(player, weapon, 10, false)
end)
how can i do with SetPedGadget or GetIsPedGadgetEquipped ?
AddEventHandler('playerSpawned', function(spawn)
local player = GetPlayerPed(-1)
local gadget = GetHashKey("GADGET_PARACHUTE")
SetPedGadget(player, gadget, 1, false)
end)
how to use it:
void SET_PED_GADGET(Ped ped, Hash gadgetHash, BOOL p2)
// 0xD0D7B1E680ED4A1A 0x8A256D0A
p1/gadgetHash was always 0xFBAB5776 (“GADGET_PARACHUTE”).
p2 is always true.
can i use “AddEventHandler” and the same code like that ?
AddEventHandler('playerSpawned', function(spawn)
local player = GetPlayerPed(-1)
local gadget = GetHashKey("GADGET_PARACHUTE")
SetPedGadget(player, gadget, 1, false)
end)
can you explain me more ?
where do you find these informations:
void SET_PED_GADGET(Ped ped, Hash gadgetHash, BOOL p2)
// 0xD0D7B1E680ED4A1A 0x8A256D0A
p1/gadgetHash was always 0xFBAB5776 (“GADGET_PARACHUTE”).
p2 is always true.