Server Start BUG
#1

I found out that when you start the server. The vehicle that created from OnGameModeInIt
doesn't go towards OnVehicleSpawn call back.
Reply
#2

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
Replace the red code with yours.
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
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
Replace the red code with yours.
So What Can I Do when the vehicles with the function AddStaticVehicleEx?
Reply
#4

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.
Reply
#5

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
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.
Like this is okay:

PHP код:

stock HF_AddStaticVehicleEX
(modelidFloatxFloatyFloatzFloatanglecolor1color2respawn_delayaddsiren 0)
{
    new
        
vehicleid AddStaticVehicleEX(modelidxyzanglecolor1color2respawn_delayaddsiren);
        
    
Vehicle_ResetData(vehicleid);
    return 
vehicleid;
}
#if defined _ALS_AddStaticVehicleEX
    #undef AddStaticVehicleEX
#else
    #define _ALS_AddStaticVehicleEX
#endif
#define AddStaticVehicleEX HF_AddStaticVehicleEX 
Reply
#6

Yes, but it is "Ex" and not "EX".
Reply
#7

Thanks you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)