27.06.2012, 15:54
Hi. In my vfunc include I hook OnVehicleSpawn to re-apply vehicle colors and set paintjobs to 'none applied'. The problem is SOME vehicles in my gamemode don't call OnVehicleSpawn when they re-spawn, either through being left un-occupied for respawn_delay or exploding.
The code for hooking OnVehicleSpawn is this:
Why is it not being called for certain vehicles? They are all created in the gamemode, at the same time, with the same function (CreateVehicle).
The code for hooking OnVehicleSpawn is this:
pawn Код:
public OnVehicleSpawn(vehicleid)
{
vehicleData[vehicleid][gVeh_Paintjob] = 3;
ChangeVehicleColours(vehicleid, vehicleData[vehicleid][gVeh_SpawnColor1], vehicleData[vehicleid][gVeh_SpawnColor2]);
return CallLocalFunction("vfunc_OnVehicleSpawn", "i", vehicleid); // Hooking method
}
#if defined _ALS_OnVehicleSpawn
#undef OnVehicleSpawn
#else
#define _ALS_OnVehicleSpawn
#endif
#define OnVehicleSpawn vfunc_OnVehicleSpawn
forward vfunc_OnVehicleSpawn(vehicleid);