Giving players items on spawn?

@Pentine there is a thermal vision in the enhanced reborn trainer

Can anyone see why this may not be working?

TriggerEvent('es:addAdminCommand', 'cop', permission.kick, function(source, args, user)
	GiveWeaponToPed(playerPed, GetHashKey("WEAPON_PISTOL50"), 1000, 0, 1)
	GiveWeaponToPed(playerPed, GetHashKey("WEAPON_STUNGUN"), 1000, 0, 1)
	GiveWeaponToPed(playerPed, GetHashKey("WEAPON_NIGHTSTICK"), 1000, 0, 1)
	GiveWeaponToPed(playerPed, GetHashKey("WEAPON_PUMPSHOTGUN"), 1000, 0, 1)
	TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Welcome Officer, Firearms have been supplied.")
end, function(source, args, user)

end)

It’s in my sv_admin.lua file which is part of Essential

EDIT - I’ve found a way to do it, will release it later :wink:

I tried this but it doesn’t seem to work… Did you try this yourself?

I got it working, I’ll put a post up soon. Got it on spawn, and commands that have loadouts aswell.

EDIT - Will make a post today (Tuesday) just have to fix a few things.

2 Likes

I tested it now, and it doesn’t work indeed. Don’t ask me why, it should work. At least that’s what i thought, lol.

Will wait for @Leah_UK’s post.

This is what i’ve got, i’ve made sure to give you credit :slight_smile: [Release] Loadout System

1 Like

any idea why SetPedGadget(GetPlayerPed(-1), 0xFBAB5776, true) isn’t working?

even

local player = GetPlayerPed(-1)
local gadget = GetHashKey("gadget_parachute")

	SetPedGadget(player, gadget, true)

is not working

You aren’t loading the model anywhere, that could be the cause, just a guess.

 local player = GetPlayerPed(-1)
            local gadget = GetHashKey("gadget_parachute")
            RequestModel(gadget)
            while not HasModelLoaded(gadget) do
                Wait(1)
           end
            SetPedGadget(player, gadget, true)

same…

Are you sure it’s “gadget_parachute” and not just “parachute”?

el stupido :thinking:

`GiveWeaponToPed(player, gadget, 1, 0, 1)`

Any way to do this without the use of essential mode base? All I’m looking for is all players be given a specified set of weapons on spawn.

1 Like

As previously mentioned on here (somewhere) you could add:

-- Default Loadout
AddEventHandler('playerSpawned', function(spawn)
	GiveWeaponToPed(playerPed, GetHashKey("WEAPON_KNIFE"), 1000, 0, 1)
	GiveWeaponToPed(playerPed, GetHashKey("WEAPON_PISTOL"), 1000, 0, 1)
end)

To a client.lua file. Hopefully that helps :wink: Weapons can be found here: https://www.se7ensins.com/forums/threads/weapon-and-explosion-hashes-list.1045035/

EDIT: Actually, I believe that may utilize EssentialMode.

I’ve made a script for a vehicle spawn that is being triggered on command /t20
But sadly it doesn’t work… :confused:

AddEventHandler("chatMessage", function(p, color, msg)
    if msg:sub(1, 1) == "/" then
        fullcmd = stringSplit(msg, " ")
        cmd = fullcmd[1]
        args = makeArgs(fullcmd)
                 
     if cmd == "/t20" then
                TriggerClientEvent("chatMessage", p, "INFO", {255, 0, 0}, vehicle .. "has been spawned" )
                local player = GetPlayerPed(-1)
                local vehicle = GetHashKey("t20")
                local coords = GetOffsetFromEntityInWorldCoords(playerPed, 0.0, 5.0, 0.0)
                local car = CreateVehicle(vehicle, coords, 0.0, true, false)
        
    end
        
end)

You could just modify the admin command “/car” that is given with Essentials Mode?

Hmmmm. I didnt checkout the essentials mode. Gotta do that then

Someone got giving parachite to player work?

I try this:

parachute = GetHashKey("gadget_parachute")
RequestModel(parachute)
while not HasModelLoaded(parachute) do
    Wait(1)
end
SetPedGadget(GetPlayerPed(-1), parachute,  true)

Not working…

EDIT: After some test, the script do pass this step:

while not HasModelLoaded(parachute) do
    Wait(1)
end

Well, if I comment it, the script is executed, but the parachute is not given to the player…

1 Like

this feature is a secret think maybe cz no support help :smiley: or maybe no one can make it work

Hello,

I would like to add a body armor to the cop, I already try something :

						GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_NIGHTSTICK"), true, true)
						GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_PISTOL50"), 150, true, true)
						GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_STUNGUN"), true, true)
						GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_PUMPSHOTGUN"), 150, true, true)
						GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_BULLPUPRIFLE"), 150, true, true) --TEST BULLPUP
						GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_BODYARMOR"), true, true)

For those that do not use a database, this works perfectly. I use it myself and have duplicated it, changing the commands to allow multiple loadouts. It doesn’t give the player weapons on spawn, but does after you enter a chat command.

https://github.com/Dolware/Loadouts/tree/master/loadouts