You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (!peer.areWeaponsAllowed() && 0 < onPlayerGiveTakeDamageRPC.WeaponID && onPlayerGiveTakeDamageRPC.WeaponID <= 47)
These lines should have validate weapon IDs under TakeDamage and GiveDamage parts of the callback, but SA-MP client can send OnPlayerTakeDamage with a wider range of weapon IDs than in OnPlayerGiveDamage: damage can be taken by reason, while can be given by weapon.
The valid reasons for OnPlayerTakeDamage are:
0..18, 22..46, 49..54 (including 52, it's half-valid despite the samp docs says)
The valid weapon IDs for OnPlayerGiveDamage are:
0..18, 22..46
including 52, it's half-valid despite the samp docs says
Reason 52 called when player shoots another player from this vehicle built-in gun, if anyone interested:
In SA-MP server, OnPlayerDeath will still be called with reason 255 if player get killed from this (and idk if it's possible to fix on the server side in omp), but at least we let it still work for TakeDamage if properly validate all possible values.
Activity
NexiusTailer commentedon Jan 10, 2023
Reason 52 called when player shoots another player from this vehicle built-in gun, if anyone interested:

In SA-MP server, OnPlayerDeath will still be called with reason 255 if player get killed from this (and idk if it's possible to fix on the server side in omp), but at least we let it still work for TakeDamage if properly validate all possible values.
NexiusTailer commentedon Jan 10, 2023
UPD:
The same logic as in OnPlayerTakeDamage (validate all possible damage reasons) should be in OnPlayerGiveDamageActor as well
open.mp/Server/Components/Actors/actors_main.cpp
Lines 31 to 66 in dcd0190
At the moment, weaponid don't checked at all.
NexiusTailer commentedon Dec 2, 2023
I think it's kinda important too, so just bump it with hope it can be fixed with higher priority.