Set Ped Armour (player, 200) code is used, but if it is revived after death, it becomes 0
i need helppp
Set Ped Armour (player, 200) code is used, but if it is revived after death, it becomes 0
i need helppp
Are you comfortable sharing your code?
Also, what’s your goal? To always have full armor after respawning?
If so, you may want to use something that tracks player death along with the code snippet you’ve used so that your player’s armor can continue to regen after respawn;
This may be a good native to use:
IsPlayerDead()
Source:
Great question:
So when it comes to native functions, there are two types of natives:
One’s that need to be called every “Frame” and ones you only need to call when it’s needed.
For this native SetPedArmour, if you called it every frame, then no matter what, the player will always have 200 armor…meaning shooting the player will be pointless. It’s unnecessary to call this native every frame, but that’s what’d happen if you did it this way.
Now because the “IsPlayerDead” native is set at the top (not in any threads), how this works is:
The natives OUTSIDE the “CreateThread” area will only be called once (once the script is executed). Now if you throw that same native in the thread, it’ll get called every frame.
What you can do is to create an if statement saying if IsPlayerDead(playerid) == true
“Do stuff”
And place it in the thread so that it’s called repeatedly.
One thing you can do after is to Set a wait, and run some kind of “Is Player Alive” native. Then give that player Armor, but this depends on a lot of factors…
Hopefully this helps!
Go to the client function for revive and add the code “SetPedArmour(ped, 200)” so that when the player revives it will give him armour again