Closed IstuntmanI closed 7 years ago
GetPlayerHealth
, GetPlayerArmour
, GetPlayerZAngle
, GetPlayerWeaponData
, GetPlayerKeys
, GetPlayerTime
, GetPlayerLastShotVectors
, GetPlayerVelocity
, GetPlayerObjectRot
, GetPlayerObjectPos
.. and many more, all are affected. while checking out if this issue is true (I can confirm this issue) I also noticed that the sampgdk_log_debug string pritings can potentially cause access voilations / segfaults on uninitialized strings (char arrays).
Thanks for reporting this. Out arguments are printed as pointers now.
Adding a second "post-call" log statement seemed like too much, I think you'd probably be better off manually adding a print statement near the call site of interest if you need the result than printing all native calls that ever happen.
Thanks for fixing it. You are right, it would be too much.
GetPlayerPos accepts 4 arguments: playerid and the addresses to store X/Y/Z in. When debug mode is enabled, we have this:
sampgdk_log_debug("GetPlayerPos(%d, %f, %f, %f)", playerid, x, y, z);
which sometimes have really weird values (not hard to understand why). I thought at first that it was a bug from my script. Shouldn't it besampgdk_log_debug("GetPlayerPos(%d, %p, %p, %p)", playerid, x, y, z);
? Also, maybe it should contain two debug messages: one with the values of the address arguments before the value is put in (debug message: playerid, X, Y, Z) and one message after the values are put in those addresses (debug message: playerid, X, Y, Z).Applies to GetPlayerVelocity, GetPlayerFacingAngle, GetPlayerHealth, GetPlayerWeaponData, GetPlayerKeys and several others, which are using at least one pass-by-address argument.
I hope that you'll have the possibility to solve this, as those files are generated when compiling, from .idl files.