Hooking functions
#1

I want to hook CreateVehicle to print a console message every time it's called.

Код:
stock CreateVehicleEx(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay, addsiren=0)
{
	print("vehicle spawned from hook");
	return CreateVehicle(modelid, x, y, z, angle, color1, color2, respawn_delay, addsiren);
}

#define CreateVehicle CreateVehicleEx
This is my code now, but when I call CreateVehicle, the message is not printed in the console.

Any ideas?
Reply
#2

Код:
stock Your_CreateVehicle(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay, addsiren=0)
{
	print("vehicle spawned from hook");
	return CreateVehicle(modelid, x, y, z, angle, color1, color2, respawn_delay, addsiren);
}
#if defined _ALS_CreateVehicle
    #undef CreateVehicle
#else
    #define _ALS_CreateVehicle
#endif
#define CreateVehicle Your_CreateVehicle
Tutorials here : Click
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)