gamemedev / plugin-sourcemod

gameME Plugin for SourceMod to manage ingame events and to extend gameME Stats!
GNU General Public License v2.0
14 stars 15 forks source link

Mark DataPacks as references in callback definitions #11

Open strafe opened 3 years ago

strafe commented 3 years ago

In 98f1126fbebd8c02a0c45a8c2f21e562f4e9b832 the callback definitions were updated to transitional syntax. However, the ampersand indicating the DataPacks are passed by reference was dropped (I assume accidentally).

In their current state, no plugins are able to use these natives as you'll receive an error when trying to manipulate the Handle:

L 01/04/2021 - 02:17:16: [SM] Exception reported: Handle 18f8 cannot be cloned because it is invalid (error 4)
L 01/04/2021 - 02:17:16: [SM] Blaming: plugin.smx
L 01/04/2021 - 02:17:16: [SM] Call stack trace:
L 01/04/2021 - 02:17:16: [SM]   [0] CloneHandle
L 01/04/2021 - 02:17:16: [SM]   [1] Line 221, plugin.sp::QueryGameMEStatsReceived
L 01/04/2021 - 02:17:16: [SM]   [3] Call_Finish
L 01/04/2021 - 02:17:16: [SM]   [4] Line 4076, gameme.sp::gameme_raw_messag

This happens because the Handle is pushed with Call_PushCellRef rather than Call_PushCell, therefore requiring the prepended ampersand: https://github.com/gamemedev/plugin-sourcemod/blob/98f1126fbebd8c02a0c45a8c2f21e562f4e9b832/scripting/gameme.sp#L3888-L3895