How do I make it so when all vehicles spawn in when the server start the bicyckles are "on"
#1

Like the title say..
Right now you must /engine the bicycle which is kinda weird.. So I'm wondering how I can make it so they are allways on?
Here is my OnVehicleSpawn..
pawn Код:
public OnVehicleSpawn(vehicleid)
{
    new string[64];
    if(IsAnOwnableCar(vehicleid))
    {
        if(CarInfo[vehicleid][cPaintjob] != 999)
        {
            ChangeVehiclePaintjob(vehicleid, CarInfo[vehicleid][cPaintjob]);
        }
        SetVehicleModifications(vehicleid);
        SetVehicleVirtualWorld(vehicleid, CarInfo[vehicleid][cVirWorld]);
        new reg = CarInfo[vehicleid][cReg];
        format(string, sizeof(string),"{157DEC}LS{FF0000}-%d-",reg);
        SetVehicleNumberPlate(vehicleid, string);
        SetVehicleToRespawn(vehicleid);
    }
    if(IsARentableVeh(vehicleid))
    {
        Gas[vehicleid] = 10;
    }
    if(IsACopCar(vehicleid))
    {
        format(string, sizeof(string),"UNIT %d",vehicleid);
        //SetVehicleToRespawn(vehicleid);
        SetVehicleNumberPlate(vehicleid, string);
        //SetVehicleToRespawn(vehicleid);
    }
    if(IsNgCar(vehicleid))
    {
        format(string, sizeof(string),"NG %d",vehicleid);
        //SetVehicleToRespawn(vehicleid);
        SetVehicleNumberPlate(vehicleid, string);
       // SetVehicleToRespawn(vehicleid);
    }
    if(IsAGovernmentCar(vehicleid))
    {
        format(string, sizeof(string),"GOV %d",vehicleid);
        //SetVehicleToRespawn(vehicleid);
        SetVehicleNumberPlate(vehicleid, string);
        //SetVehicleToRespawn(vehicleid);
    }
    if(IsASalesVehicle(vehicleid))
    {
        format(string, sizeof(string),"{FF0000}FOR SALE");
        //SetVehicleToRespawn(vehicleid);
        SetVehicleNumberPlate(vehicleid, string);
        //SetVehicleToRespawn(vehicleid);
    }
    gEngine[vehicleid] = 0;
    engineOn[vehicleid] = 0;
    if(IsModelABycicle(vehicleid))
    {
        new engine,lights,alarm,doors,bonnet,boot,objective;
        GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
        engineOn[vehicleid] = true;
        gEngine[vehicleid] = true;
        engineOn[vehicleid] = true;
        RestartCar(vehicleid);
        return 1;
    }
    return 1;
}
Reply
#2

OnVehicleSpawn is only called when a vehicle respawns.
So you need to set the engine parameter to on when the vehicle is created, too.

pawn Код:
new vehicleid = CreateVehicle(....);
if(IsModelABycicle(vehicleid))
{
 GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
 SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
}
Reply
#3

Quote:
Originally Posted by RedFusion
Посмотреть сообщение
OnVehicleSpawn is only called when a vehicle respawns.
So you need to set the engine parameter to on when the vehicle is created, too.

pawn Код:
new vehicleid = CreateVehicle(....);
if(IsModelABycicle(vehicleid))
{
 GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
 SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
}
Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)