21.02.2013, 01:18
Hmmm, from my experience writing anti-lag systems this is not a good way to write it. It's actually better to make your own OnPlayerDeath() callback usually OnPlayerDeathEx() or whatever you want to call it then calculate damage through OnPlayerTakeDamage() and manually set health/armor there so you know when the player dies then make the call to OnPlayerDeathEx(). In this way OnPlayerGiveDamage() would actually call OnPlayerTakeDamage() to issue a hit you can also do some other stuff with this system such as removing the need to set all players to the same team so lead aim and anti-lag can be combined (requires waiting to see if OnPlayerTakeDamage() is called to prevent double hitting).
One more suggestion instead of doing this....
lasthit[playerid] = -1;
Do this to improve readability
lasthit[playerid] = INVALID_PLAYER_ID;
One more suggestion instead of doing this....
lasthit[playerid] = -1;
Do this to improve readability
lasthit[playerid] = INVALID_PLAYER_ID;