[REQ] Loadout Script (kinda specific)

roleplay
request

#1

Hey, I’m looking for a loadout script that equips just the weapons (and flashlight attachments, if possible) to the player. I know there are a few scripts out there, but they either change your ped model (or only work for a specific ped) and they use essentialmode, which I don’t use on our server.

We were hoping it would work something like this:
a user would do /loadout cop and they would receive a combat pistol, pump shotgun and carbine rifle all with flashlights, baton, stun gun, fire extinguisher, flares and a flashlight. Similar to AlfredoHelper that was released awhile back. That would be fantastic.

Thanks for looking!


#2

Server:

AddEventHandler('chatMessage', function(s, n, m)
	local message = string.lower(m)
	if message == "/guns" then
		CancelEvent()
		--------------
		TriggerClientEvent('guns', s)
	end
end)

Client:

RegisterNetEvent('guns')
AddEventHandler('guns', function()
	local player = GetPlayerPed(-1)
		Citizen.CreateThread(function()
			local rifle = GetHashKey("WEAPON_CARBINERIFLE")
			local shotgun = GetHashKey("WEAPON_PUMPSHOTGUN")
			local pistol = GetHashKey("WEAPON_PISTOL")
			local taser = GetHashKey("WEAPON_STUNGUN")
			local baton = GetHashKey("WEAPON_NIGHTSTICK")
			local torch = GetHashKey("WEAPON_FLASHLIGHT")
			GiveWeaponToPed(player, rifle, 1000, 0, 1)
            GiveWeaponToPed(player, shotgun, 1000, 0, 1)
            GiveWeaponToPed(player, pistol, 1000, 0, 1)
            GiveWeaponToPed(player, taser, 1000, 0, 0)
            GiveWeaponToPed(player, baton, 1000, 0, 0)
			GiveWeaponToPed(player, torch, 1000, 0, 0)
		end)
end)

As for the attachments, never tried to do it, but this is a starting point I guess.

If it helps let me know. :slight_smile:


#3

It works! If I wanted to add the fire extinguisher and the (road) flare, what do I put for the part that says “local ___”?

i.e. "local ___ = GetHashKey (“WEAPON_FIREEXTINGUISHER”)
"local___= GetHashKey (“WEAPON_FLARE”)

And then if I wanted to make more than one loadout or rename the loadout, how would I do that?


#4
GiveWeaponToPed(___, __, 0, 1)

A basic template. As soon as you get the HashKey to the weapon, all you have to do is define it and give it to the Ped(Player).

If you wanted to give more than just whats there.


#5

Thats the variable name… so just do something like this:

local extinguisher = GetHashKey("WEAPONFIREEXTINGUISHER")
local flare = GetHashKey("WEAPON_FLARE")

GiveWeaponToPed(player, extinguisher, 1000, 0, 0) 
GiveWeaponToPed(player, flare, 1000, 0, 0)

#6

idk if im doin something wrong, but i can’t get this script to work for some reason @Dalek


#7

how did you get this script to work @Mikofiticus? I add it to my server and i dont get nothing