Cancel the option to shoot those who raise their hands up
Ummm what?
1 Like
It sounds like you want to make it where players who have their hands up have a grayed out reticle over them so that they can’t be damaged by gunfire. If so, I’d try something like this to start:
- Create a /handsup command which does two things. First, trigger a hands up animation through a net event in a client.lua. Next, add that player’s server ID to a table of players who currently have their hands up.
- Sync the table of players who actively have their hands up from the server → client to all players and apply the NetworkSetFriendlyFireOption(enable) and SetCanAttackFriendly(PlayerPedId(), enable, false) natives to the player with their hands up on all clients.
Make sure to add a mechanism to remove the SetCanAttackFriendly from the player if they no longer have their hands up. You can use something like IsEntityPlayingAnim to check if the player still has their hands up.