Making a Hat Mod, Need a Little Help

Hi guys,

Need a little help. I haven’t coded for a good few years, just getting back into it for FiveM. I am making a /hat command that will set police hats for my cops. I have gone through the game files and have found all of the hat IDs such as:

s_f_y_cop_01_p.ydd - p_head_000
s_m_y_cop_01_p.ydd - p_head_000

How would I make a resource to turn these into a /hat command? I have looked at a few other resources and get the whole client/server files side of things but I’m not too sure on which functions to use and what they would come under, either server or client. I think I would need to use:

SET_PED_PROP_INDEX(Ped ped, int componentId, int drawableId, int TextureId, BOOL attach)

But wasn’t sure what the component ids and texture ids would be in relation to the hat IDs I had found from the game files. I also wasn’t sure how the command would work, whether it would need to send the command from the client to the server then the server return something to the client file. Any help would be greatly appreciated. If I can figure out how to make commands work and what functions I’d need I could probably get the rest of the Lua down. Just shaking off the rust still.

If I get this down I’d like to eventually tie it into my permissions system so only my cops can use it. But just getting a command that cycles through a few hats would be an awesome start. :slight_smile:

Also any helpful resources would be greatly appreciated.

Thanks in advance,

CombatMedic02

If anyone could help me figure this out I’d be able to get other clothing working too and would be able to put out a few decent releases. Just need to know how to do this to get started.

I know that’s a little bit late but yes you have to use SetPedPropIndex(). the componentId is the type of prop to be set (for example hats or glasses). the drawable id is the model of component id (in your case the drawable id is the cop hat, but it can also be a golf hat for example). the texture id is the texture variation of the drawable id (for example the color of an hat). in order to use SetPedPropIndex() to set the police hat you have to know the drawable id of the cop hat first. i don’t know what number is the police hat, you have to try all the numbers and see what is the hat you’re looking for.