30.01.2017, 03:11
You shouldn't try setting health under OnPlayerTakeDamage or under OnPlayerGiveDamage because it could be a problem due to SA-MP sync. I suggest you to read the topic by Slice in understanding SA-MP sync.
You can add more damage rate for a weapon but if you're trying to customize the weapon damage totally, I suggest you to work on server sided health system, which is the best method to have complete control over damage rates.
I once created an include called L_Skills that adds more damage to any weapon. But now I realise that it could be a problem while dealing with players having high ping, say 350+. I wasn't aware about SA-MP sync those days and never cared about updating it either (mostly due to lack of motivation). To have a fix over such an issue, it's better to have a boolean variable to know if the update for health change has been triggered under take/give damage callback and then reduce the health under OnPlayerUpdate only. I had tested this earlier and seemed to work flawlessly.
You can add more damage rate for a weapon but if you're trying to customize the weapon damage totally, I suggest you to work on server sided health system, which is the best method to have complete control over damage rates.
I once created an include called L_Skills that adds more damage to any weapon. But now I realise that it could be a problem while dealing with players having high ping, say 350+. I wasn't aware about SA-MP sync those days and never cared about updating it either (mostly due to lack of motivation). To have a fix over such an issue, it's better to have a boolean variable to know if the update for health change has been triggered under take/give damage callback and then reduce the health under OnPlayerUpdate only. I had tested this earlier and seemed to work flawlessly.