reapi
reapi copied to clipboard
The rh_emit_sound2 native is broken
Hello, it seems that the rh_emit_sound2 native is broken. I wrote a plugin example that I tested on TFC.
Didn't test in other mods, but since it's broken on Team Fortress Classic, I guess it is on all of them. Hope it will be fixed :)
#include <amxmodx>
#include <reapi>
new const umbrella_sound[] = "weapons/cbar_miss1.wav";
public plugin_init() {
register_clcmd("say /sound", "PlaySound");
}
public PlaySound(id) {
rh_emit_sound2(id, id, CHAN_ITEM, umbrella_sound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
}
public plugin_precache() {
precache_sound(umbrella_sound);
}
rh_emit_sound2
uses checks that are specific to the CS gamedll:
https://github.com/s1lentq/reapi/blob/efcc3952b5d2a96280521d98d1ec6072c5d39175/reapi/src/natives/natives_misc.cpp#L2657-L2663
CHECK_CONNECTED
uses has_disconnected
field which is present only in CS. IsNetClient
also cannot be used in cross-game code because function offsets inside vtables aren't the same across the different games.
rh_update_user_info
is also affected by this:
https://github.com/s1lentq/reapi/blob/efcc3952b5d2a96280521d98d1ec6072c5d39175/reapi/src/natives/natives_misc.cpp#L2689-L2690
There are also common natives affected:
-
GetGrenadeType
- but I hope it should be CS-specific anyway -
engset_view
-
GetBonePosition
- not sure -
GetAttachment
- not sure -
SetThink
- should rely on gamedata to be not CS-specific -
SetTouch
- same asSetThink
-
SetUse
- same asSetThink
-
SetBlocked
- same asSetThink
-
SetMoveDone
- same asSetThink
-
is_entity
rh_emit_sound2
uses checks that are specific to the CS gamedll:https://github.com/s1lentq/reapi/blob/efcc3952b5d2a96280521d98d1ec6072c5d39175/reapi/src/natives/natives_misc.cpp#L2657-L2663
CHECK_CONNECTED
useshas_disconnected
field which is present only in CS.IsNetClient
also cannot be used in cross-game code because function offsets inside vtables aren't the same across the different games.
rh_update_user_info
is also affected by this:https://github.com/s1lentq/reapi/blob/efcc3952b5d2a96280521d98d1ec6072c5d39175/reapi/src/natives/natives_misc.cpp#L2689-L2690
There are also common natives affected:
GetGrenadeType
- but I hope it should be RG specific anywayengset_view
GetBonePosition
- not sureGetAttachment
- not sureSetThink
- should rely on gamedata to be not RG specificSetTouch
- same asSetThink
SetUse
- same asSetThink
SetBlocked
- same asSetThink
SetMoveDone
- same asSetThink
is_entity
Then I guess since they rely on CS they must be moved to regamedll or if not in the native description it should be stated that all the mentioned natives are only for CS only.