Function hook problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Function hook problem (
/showthread.php?tid=665686)
Function hook problem -
Marshas - 13.04.2019
Hello everyone!
I tried to hook CreateVehicle function with ALS method, but I just couldn't, it won't work, custom function isn't called, but there is no error saying, that _CreateVehicle is not used.
Code:
_CreateVehicle(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay, addsiren=0)
{
new vehicleid = CreateVehicle(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay, addsiren=0);
Iter_Add(Vehicles, vehicleid);
return vehicleid;
}
/*************************|FUNCTION HOOKS|*************************/
#if defined _ALS_CreateVehicle
#undef CreateVehicle
#else
#define _ALS_CreateVehicle
#endif
#define CreateVehicle _CreateVehicle
This is my code, where is the problem? Thanks in advance!
Re: Function hook problem -
Marshas - 13.04.2019
SOLVED!
I managed to fail, and hook CreateVehicle function at the end of the script, after calling CreateVehicle itself.