23.02.2018, 14:07
Quote:
You could save yourself a lot of work by looking into weapon-config.inc by Slice, which also offers a lot of other nice features and bug fixes, including damaging and killing AFK Players with death animations (with correct health bars).
It's also configurable, so if you don't want to use certain features you can disable them. https://sampforum.blast.hk/showthread.php?tid=563387 It's also super efficient against any kind of health or weapon hacks. If you want to do it on your own, you need to check the server-sided health everywhere in your script instead of GetPlayerHealth (best would be to hook it, but that's not really neccessary). You also need to process every type of damage a player takes correctly, like fall damage or explosions that aren't caused by other players (exploding vehicles, CreateExplosion, etc) via OnPlayerTakeDamage. If you decide to not use weapon-config I still suggest you to look at it. It's really well done and it's exactly how a custom damage/health system should look like, in my opinion. |
I set every player (onplayerconnect + Onplayerspawn) to the same team ( SetPlayerTeam(playerid, 0) ) to know that no one take damage without the pHealth or pArmour to be changed, and When OnPlayerTakeDamage is called I do this:
https://pastebin.com/JwK28ZCp
But, sometimes OnPlayerTakeDamage isn't called / player don't take the damage when someone shoot in him.
I now I can use OnPlayerGiveDamage, but like I said, the script same as onplayertakedamage to onplayergivedamage when the damagedid is AFK(not streamed with playerid).
So , how can I fix this?