11.06.2016, 09:03
I found out that when you start the server. The vehicle that created from OnGameModeInIt
doesn't go towards OnVehicleSpawn call back.
doesn't go towards OnVehicleSpawn call back.
stock HF_CreateVehicle(modelid, Float: x, Float: y, Float: z, Float: angle, color1, color2, respawn_delay, addsiren = 0) { new vehicleid = CreateVehicle(modelid, x, y, z, angle, color1, color2, respawn_delay, addsiren); Iter_Add(Vehicle, vehicleid); SetVehicleHealth(vehicleid, 999.0); return vehicleid; } #if defined _ALS_CreateVehicle #undef CreateVehicle #else #define _ALS_CreateVehicle #endif #define CreateVehicle HF_CreateVehicle
The name of OnVehicleSpawn callback is misleading. It is called when a vehicle re-spawns, not when it is created.
If you want to do stuff when a vehicle is created, hook the functions. An example with CreateVehicle: Код:
stock HF_CreateVehicle(modelid, Float: x, Float: y, Float: z, Float: angle, color1, color2, respawn_delay, addsiren = 0) { new vehicleid = CreateVehicle(modelid, x, y, z, angle, color1, color2, respawn_delay, addsiren); Iter_Add(Vehicle, vehicleid); SetVehicleHealth(vehicleid, 999.0); return vehicleid; } #if defined _ALS_CreateVehicle #undef CreateVehicle #else #define _ALS_CreateVehicle #endif #define CreateVehicle HF_CreateVehicle |
Exactly the same, just replacing anywhere you see "CreateVehicle" with "AddStaticVehicleEx" at the code above. Their parameters are the same so you won't have to change anything else.
|
stock HF_AddStaticVehicleEX(modelid, Float: x, Float: y, Float: z, Float: angle, color1, color2, respawn_delay, addsiren = 0)
{
new
vehicleid = AddStaticVehicleEX(modelid, x, y, z, angle, color1, color2, respawn_delay, addsiren);
Vehicle_ResetData(vehicleid);
return vehicleid;
}
#if defined _ALS_AddStaticVehicleEX
#undef AddStaticVehicleEX
#else
#define _ALS_AddStaticVehicleEX
#endif
#define AddStaticVehicleEX HF_AddStaticVehicleEX