Equip A Vest and Heal Player with Keymapping Script

Hello there,
Ive been looking for a script that enables players to equip body armor (via AddArmourToPed(GetPlayerPed(-1), 100)) or heal themselves (via SetEntityHealth(GetPlayerPed(-1), 200)) with a key to do so. That shouldnt happen in an instant though but should take like a few seconds during which the player is unable to move or equip a weapon. In a best case scenario it also has a progressBar which shows the player how far they have progressed in trying to apply the vest. I would like to have this a script like this for a PvP gamemode in which it doesnt matter if you actually have a vest as an item in your inventory but which allows you to equip one anyways. It would also be great if there was something similar for healing the player by pressing a different key.

Does anyone if a script like this already exists or how I could possibly make one?

Thanks in advance.

Hey!

There is a video on YouTube from Jeva that shows how to create a simple Key Press resource to give weapons to player.

If you use just a basic .LUA knowledge, you can simply aply this system that you wanto to create.

In the website “FiveM Natives” you can find some natives that you can use in your resource.

FiveM Natives:

Finally, sorry for my english (I’m Brazilian) and if you need any help, just reply my message!

Bye and happy hacking.

Oh, no problem!

I’m happy to be able to help, and as I said, any help you need, don’t hesitate to ask.

Any news let me know through this topic.

Bye and happy hacking!

1 Like

Hey!

I’m not sure how to use this native “AddArmourToPed”. I highly recommend you use both native ones I sent in the first reply.

As for the notification part, which framework are you using?

“Sadly, the code only works until the ped is freezed.”

You declared that the ped needed to be frozen in order for the rest of the code to run, so when the ped is no longer frozen, it will consequently not run.

FreezeEntityPosition(PlayerPedId(), true)

I hope I have helped and that I have clarified your doubts.

Bye and happy hacking!

Appreciated!

In the FiveM Natives website it just says to use what you used.

FreezeEntityPosition(PlayerPedId(), false)