0.3c Engine
#1

pawn Код:
if(strcmp(cmd, "/car", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new x_nr[32];
            x_nr = strtok(cmdtext, idx);
            new veh = GetPlayerVehicleID(playerid);
            new engine,lights,alarm,doors,hood,trunk,objective;
            if(!strlen(x_nr))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /car [name]");
                SendClientMessage(playerid, COLOR_GRAD1, "Available names: Engine, Lights, Hood, Trunk");
                return 1;
            }
            if(strcmp(x_nr,"engine",true) == 0)
            {
                if(GetPVarInt(playerid, "Engine") == 0)
                {
                    GetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,trunk,objective);
                    SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,lights,alarm,doors,hood,trunk,objective);
                    SendClientMessage(playerid, COLOR_WHITE, "Vehicle Engine starting, please wait.");
                    SetPVarInt(playerid, "Engine", 1);
                }
                else if(GetPVarInt(playerid, "Engine") == 1)
                {
                    GetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,trunk,objective);
                    SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lights,alarm,doors,hood,trunk,objective);
                    SendClientMessage(playerid, COLOR_WHITE, "Vehicle Engine stopped successfully.");
                    SetPVarInt(playerid, "Engine", 0);
                }
                return 1;
            }
            if(strcmp(x_nr,"lights",true) == 0)
            {
                if(GetPVarInt(playerid, "Lights") == 0)
                {
                    GetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,trunk,objective);
                    SetVehicleParamsEx(veh,engine,VEHICLE_PARAMS_ON,alarm,doors,hood,trunk,objective);
                    SetPVarInt(playerid, "Lights", 1);
                }
                else if(GetPVarInt(playerid, "Lights") == 1)
                {
                    GetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,trunk,objective);
                    SetVehicleParamsEx(veh,engine,VEHICLE_PARAMS_OFF,alarm,doors,hood,trunk,objective);
                    SetPVarInt(playerid, "Lights", 0);
                }
                return 1;
            }
            if(strcmp(x_nr,"hood",true) == 0)
            {
                if(GetPVarInt(playerid, "Hood") == 0)
                {
                    GetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,trunk,objective);
                    SetVehicleParamsEx(veh,engine,lights,alarm,doors,VEHICLE_PARAMS_ON,trunk,objective);
                    SetPVarInt(playerid, "Hood", 1);
                }
                else if(GetPVarInt(playerid, "Hood") == 1)
                {
                    GetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,trunk,objective);
                    SetVehicleParamsEx(veh,engine,lights,alarm,doors,VEHICLE_PARAMS_OFF,trunk,objective);
                    SetPVarInt(playerid, "Hood", 0);
                }
                return 1;
            }
            if(strcmp(x_nr,"trunk",true) == 0)
            {
                if(GetPVarInt(playerid, "Trunk") == 0)
                {
                    GetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,trunk,objective);
                    SetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,VEHICLE_PARAMS_ON,objective);
                    SetPVarInt(playerid, "Trunk", 1);
                }
                else if(GetPVarInt(playerid, "Trunk") == 1)
                {
                    GetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,trunk,objective);
                    SetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,VEHICLE_PARAMS_OFF,objective);
                    SetPVarInt(playerid, "Trunk", 0);
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   Invalid drop name !");
                return 1;
            }
        }
        return 1;
    }
How to make vehicle spawn with engine OFF
Reply
#2

See the use of this function:

https://sampwiki.blast.hk/wiki/ManualVehicleEngineAndLights
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)