open.mp icon indicating copy to clipboard operation
open.mp copied to clipboard

Improve `RemovePlayerWeapon` native

Open NexiusTailer opened this issue 2 months ago • 1 comments

Currently, RemovePlayerWeapon removes any weapon without setting armed (holding) weapon to the last reported by that player and it looks not so nice. Let's imagine 2 cases to see what happens and what can be done to improve this behaviour.

Case 1: Player has deagle, shotgun and rifle, deagle is armed in his hands at the moment. Server tries to remove shotgun, RemovePlayerWeapon re-gives all weapons and the armed weapon automatically switches to rifle for this player.

Case 2: Player has deagle, shotgun and rifle, deagle is armed in his hands at the moment. Server tries to remove deagle, RemovePlayerWeapon re-gives all weapons and the armed weapon still automatically switches to rifle for this player.

What can be done to easily correct case 1 behaviour is to just switch armed weapon to the last armed weapon which player had, if this weapon wasn't removed by the server. Case 2 is probably more complicated to decide which weapon this player should be switched to after removing exactly the one he was holding. This could be either switched to slot 0 (fist/brass knuckles), or the other variant is to switch it to the next weapon slot after the one that was removed.

NexiusTailer avatar Apr 19 '24 12:04 NexiusTailer