Hooking CreateVehicle
#1

SOLVED

As the title of the thread suggests, I want to hook the CreateVehicle function. So far, this is the code I've got:

pawn Код:
stock realCreateVehicle(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay)
{
    new vehicleid = CreateVehicle(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay);
   
    // other code here 
    return vehicleid;
}

#if defined _ALS_CreateVehicle
    #undef CreateVehicle
#else
    #define _ALS_CreateVehicle
#endif
#define CreateVehicle realCreateVehicle
However, the hook doesn't seem to get called. Am I doing it wrong, or is hooking this function not plausible?
Reply
#2

Looks fine. Tried putting some prints inside your createvehicle?

#e: works fine too
#e2: make sure that you hook function before calling it in code
Reply
#3

Quote:
Originally Posted by Misiur
Посмотреть сообщение
#e2: make sure that you hook function before calling it in code


At least my scripting errors are generally easy to solve... Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)