Simple Loadout Script is a easy to use and install loadout script made by ECLIP3S. All you have to do is install and type /loadout in game. Keep in mind this is my first release so please go easy on me.
So, is it possible to only have this for a few jobs? Like mecano with the repair kit, ambulance with the med kit and the police with the gun and nightstick.
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)
Server.lua
AddEventHandler(‘chatMessage’, function(set, n, e)
local message = string.lower(e)
if message == “/onduty” then
CancelEvent()
TriggerClientEvent(‘guns’, set)
end
end)
This code does the same but allows for you to set attachments therefore better optimized.