[OLD-OUTDATED][Release] Loadout System

I just dont understand, the /loadout, /loadout cop, whatever, does not work.
The random peds work fine when spawning in.

Here is what I have

https://gyazo.com/28409277a10955f500ec5dd61cceefa6

where do i put the

		name = "^4cop",

or something else !

Inside the ā€œnameā€ property, so

LOADOUTS = {
    ["cop"] = {
        name = "^4Cop"
    }
}
1 Like

okay ty i just post the same :stuck_out_tongue:

Hello i was wondering is their away to make this have an option to have a certain vehicle spawn in for instance cop would give you the police or police2

Hello guys, I have got a issue with the loadout system : the command /loadout cop doesnĀ“t do anything but the players spawn with custom clothes :S
I added the loadout system from github, added it to autorestarts, I set lvl permission 4 into DB and I have installed essentialmode.

Thanks in advance

1 Like

No but, I was planning on adding this feature in future. Just a little busy at the moment with University.

Itā€™s in the ā€œserver.luaā€ file, specifically lines 30 and 31. Or, if you want to know how you can do it for themā€¦ Just add more skins :stuck_out_tongue:

https://github.com/TGRHavoc/fivem-loadouts/blob/master/loadout/server.lua#L30

Have the players got permission for this command? If not, it should pop up at the bottom of the screen saying they donā€™t. I donā€™t get how ā€œnothingā€ is happening. Whatā€™s the console look like when a command is executed?

how fix that plz ?

Assuming itā€™s the loadout system thatā€™s in ā€œcustom_scriptsā€ then try checking the loadouts.lua file for a missing ā€œ]ā€.

Hello, can someone tell me why i got this when someone is connecting ? :

2017-04-11 17:42:40.7172|ERROR|CitizenMP.Server|Error executing event handler for event loadout:doLoadout in resource fivem-loadouts: Exception has been thrown by the target of an invocation.
2017-04-11 17:42:40.7200|ERROR|CitizenMP.Server| at [U] System.Reflection.MonoMethod.Invoke(Object obj,BindingFlags invokeAttr,Binder binder,Object[] parameters,CultureInfo culture)
2017-04-11 17:42:40.7200|ERROR|CitizenMP.Server| at [U] System.Reflection.MethodBase.Invoke(Object obj,Object[] parameters)
2017-04-11 17:42:40.7200|ERROR|CitizenMP.Server| at [U] System.Delegate.DynamicInvokeImpl(Object[] args)
2017-04-11 17:42:40.7200|ERROR|CitizenMP.Server| at [U] System.MulticastDelegate.DynamicInvokeImpl(Object[] args)
2017-04-11 17:42:40.7200|ERROR|CitizenMP.Server| at [U] System.Delegate.DynamicInvoke(Object[] args)
2017-04-11 17:42:40.7200|ERROR|CitizenMP.Server| at [U] CitizenMP.Server.Resources.ScriptEnvironment.TriggerEvent(String eventName,String argsSerialized,Int32 source)
2017-04-11 17:42:40.7203|ERROR|CitizenMP.Server|Inner exception: Object is nil.
2017-04-11 17:43:32.0246|INFO|CitizenMP.Server|Client Airbourne quit.

Thanks by advance

It looks like its trying to perform ā€œdoLoadoutā€ on a loadout that doesnā€™t exist. Have you modified the code in someway or the loadout file?

Edit: If youā€™re trying to remove the random skin when a player spawns, you canā€™t just remove it from the loadout.lua file. You also need to edit the server.lua file, specifically line 9.

https://github.com/TGRHavoc/fivem-loadouts/blob/master/loadout/server.lua#L9

Here is my loadout file, can you tell me how can i fix it ?

-- Edit the table below for more loadouts!
LOADOUTS =  {
	["police"] = {
		name = "Police",
		permission_level = 0,
		weapons = { "WEAPON_PISTOL50", "WEAPON_STUNGUN", "WEAPON_NIGHTSTICK", "WEAPON_PUMPSHOTGUN", "WEAPON_FLAREGUN" },
		skins = { "s_m_y_cop_01", "s_m_y_cop_01" }
	},
	["bri"] = {
		name = "BRI",
		permission_level = 2,
		weapons = { "WEAPON_PISTOL50", "WEAPON_STUNGUN", "WEAPON_NIGHTSTICK", "WEAPON_PUMPSHOTGUN", "WEAPON_FLAREGUN", "WEAPON_ASSAULTSMG" },
		skins = { "s_m_y_swat_01", "s_m_y_swat_01" }
	},
	["gendarmerie"] = {
		name = "Gendarmerie",
		weapons = { "WEAPON_PISTOL50", "WEAPON_STUNGUN", "WEAPON_NIGHTSTICK", "WEAPON_PUMPSHOTGUN", "WEAPON_FLAREGUN" },
		skins = { "s_m_y_sheriff_01", "s_m_y_sheriff_01" }
	},
    ["csi"] = {
		name = "CSI",
		weapons = { "WEAPON_PISTOL50", "WEAPON_STUNGUN", "WEAPON_NIGHTSTICK", "WEAPON_PUMPSHOTGUN", "WEAPON_FLAREGUN" },
		skins = { "s_m_y_hwaycop_01", "s_m_y_hwaycop_01" }
	},
	["bac"] = {
		name = "BAC",
		weapons = { "WEAPON_PISTOL50", "WEAPON_STUNGUN", "WEAPON_NIGHTSTICK", "WEAPON_PUMPSHOTGUN", "WEAPON_FLAREGUN", "WEAPON_ASSAULTSMG" },
		skins = { "s_m_m_ciasec_01", "s_m_m_ciasec_01" }
	},
	["infirmier"] = {
		name = "Infirmier",
		weapons = { "WEAPON_FLAREGUN" },
		skins = { "s_m_m_paramedic_01", "s_m_m_paramedic_01"}
	},
	["pompier"] = {
		name = "Pompier",
		weapons = { "WEAPON_FLAREGUN", "WEAPON_FIREEXTINGUISHER" },
		skins = { "s_m_y_fireman_01", "s_m_y_fireman_01"}
	}
}

And if u have the time can you help me to set a spawn position cause i still donā€™t understand how to respawn the player after selecting a loadout. There was a topic but it doesnā€™t work and give me a ton of errorsā€¦
Thanks by advance :slight_smile:

@Ruben27 Havoc explained exactly what the problem is. By default, when a user spawns, it sets their loadout to ā€œrandomā€. You removed ā€œrandomā€ from LOADOUTS. You need to find the highlighted line that Havoc showed above and change where it says ā€œrandomā€ to what you want the default loadout to be.

This loadout Script is AMAZING! Thank you for sharing it with the community~!

you wouldnt happen to know of any way to add a Mask to the random loadout would you?

My end goal is to hopefully add 2 or more masks to the random loadout.
Meaning, ā€œa_m_y_skater_01ā€ could randomly be selected with either mask 1 or mask 2 already equipped.

can you show me an example of a how to add a random skin? like for cop

Yea, If you want I can try and add support for masks in the next update but, if you donā€™t want to wait then try the following:

  • Get the mask hash
  • Convert the hexidecimal hash to a number
    E.g. The Zombie/Devil mask (0x00000008) will become 8.
  • Put it in a ā€œmaskā€ array in the loadout
  • On ā€œdoLoadoutā€ get the random mask number
  • Call SetPedPropIndex on client side (Something like)
SetPedPropIndex( GetPlayerPed(-1), 0, maskNumberHere, 0, 2) -- First 0 = Head, Second = Colour Variation, 2 = Constant
  • Win?

Note: Iā€™ve not actually tested this, no guarantee that itā€™ll work :stuck_out_tongue_winking_eye:

@roboticgamer, just add more entries to the ā€œskinā€ array.
i.e. For the cop:

["cop"] = {
  skins = { "s_m_y_swat_01", "s_m_y_ranger_01", "csb_cop" }
}

Then the script will choose a skin at random from that list.

2 Likes

No I already know how to do that ok let me be more clear is when I pick a skin it randomizes the skin to like a black cop or a white cop then having the same skin. So basically I want for the skin itself to be randomized like short sleeves or long sleeves you getting what am saying?

Ah, now I get you.

There isnā€™t much documentation about this so, Iā€™ll give you some links to resources you may find useful.

For changing the skintone and the likes, try here (I know youā€™re not creating an online character but, It may help somewhat) or here.

Note: Game.Player.Character.Handle is the same as GetPlayerPed(-1) (I think).

As for clothes, Iā€™ve found this link to be very useful myself. Along with a list of cloth hashes.

Hi @Havoc really cool script here iā€™m trying to upgrade it and link the skins with the DB but iā€™m having some troubles with no error message and my function not working do you think you could help me out ?

how add bodyarmor in my loadout guys