18.04.2012, 14:23
Hey guys
Lets say my plugin wants to get a notification when a player enters a vehicle: i want to hook the "OnPlayerEnterVehicle" callback.
I already know how to hook functions in plugins (by the way, thanks to user 0x5A656578 )
(http://forum.sa-mp.com/showthread.ph...ok+callbacks):
Although I have been searching for some days, I cant find ANYTHING.. That surprises me 0o
I am not sure if hooking callbacks is just another taboo topic here....
but I am really thankfull for a bit help.
Thank you,
webcode421F
Lets say my plugin wants to get a notification when a player enters a vehicle: i want to hook the "OnPlayerEnterVehicle" callback.
I already know how to hook functions in plugins (by the way, thanks to user 0x5A656578 )
(http://forum.sa-mp.com/showthread.ph...ok+callbacks):
Код:
// This code overrids "SetPlayerPos" AMX_NATIVE SetPlayerPos; cell AMX_NATIVE_CALL MySetPlayerPos(AMX *amx, cell *params) { logprintf("SetPlayerPos called!"); return SetPlayerPos(amx, params); } int index=0; if(amx_FindNative(amx, "SetPlayerPos", &index) == AMX_ERR_NONE) { AMX_HEADER *hdr = reinterpret_cast<AMX_HEADER*>(amx->base); AMX_FUNCSTUBNT *natives = reinterpret_cast<AMX_FUNCSTUBNT*>(amx->base + hdr->natives); ::SetPlayerPos = reinterpret_cast<AMX_NATIVE>(natives[index].address); natives[index].address = reinterpret_cast<ucell>(MySetPlayerPos); logprintf(" SetPlayerPos found"); } else { logprintf(" SetPlayerPos NOT found"); }
I am not sure if hooking callbacks is just another taboo topic here....
but I am really thankfull for a bit help.
Thank you,
webcode421F