/engine problem
#1

I have this command for turn on the engine, how can i make it if the car has no gas u can't turn on the engine ?

pawn Код:
if(strcmp(cmd,"/engineon",true) == 0)
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new Vehicle = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            SendClientMessage(playerid, COLOR_YELLOW, "You have turned your engine >{FFFFFF} ON");
            Engine[Vehicle] = 1;
            SetVehicleParamsEx(Vehicle, 1, lights, alarm, doors, bonnet, boot, objective);
        }
        return 1;
    }
Reply
#2

pawn Код:
if(strcmp(cmd, "/engine", true) == 0)
    {
    if(!IsPlayerInAnyVehicle(playerid)) return scm(playerid,c_r,"( ! ) You're not in any vehicle to use /engine");
    if(GetPlayerVehicleSeat(playerid) !=0) return scm(playerid,c_r,"( ! ) You're not driver of this vehicle for use /engine !");
    new vehicle = GetPlayerVehicleID(playerid);
    new engine, lights, alarm, doors, bonnet, boot, objective;
    GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
    if(engine != 0)
    {
    SetVehicleParamsEx(vehicle,false,lights,alarm,doors,bonnet,boot,objective);
    scm(playerid,COLOR_GREEN,"( ! ) Engine is off !");
    return 1;
    }
    else if(engine != 1)
    {
    SetVehicleParamsEx(vehicle,true,lights,alarm,doors,bonnet,boot,objective);
    scm(playerid,COLOR_GREEN,"( ! ) Engine is on !");
    }
    return 1;
    }
use this, its my cmd and its works good, the cmd switch on and off
Reply
#3

that command dosen't work
Reply
#4

pawn Код:
if(strcmp(cmd, "/engine", true) == 0)
{
    if ( !IsPlayerInAnyVehicle ( playerid ) ) return SendClientMessage ( playerid , -1 , "[LVehicle]:You Are Not In An Vehicle!" ) ;
    new vid = GetPlayerVehicleID ( playerid ) ;
    new engine, lights, alarm, doors, bonnet, boot, objective;
    GetVehicleParamsEx ( vid , engine , lights , alarm , doors , bonnet , boot , objective ) ;
    if ( !IsValidVehicleID ( vid ) ) return SendClientMessage ( playerid , -1 , "[LVehicle]:That Is An Invalid Vehicle!" ) ;
    if ( !IsVehicleStreamedIn ( vid , playerid ) ) return SendClientMessage ( playerid , -1 , "[LVehicle]:This Vehicle Dosent Seems To Be Streamed In!, Contact An Administrator ASAP!" ) ;
    else
    {
            switch(engine){
            case 1:
        {
            SetVehicleParamsEx ( vid , 0 , lights , alarm , doors , bonnet , boot , objective ) ;
            SendClientMessage ( playerid , -1 , "[LVehicle]:Engine Off!" ) ;
        }
        default:
        {
            SetVehicleParamsEx ( vid , 1 , lights , alarm , doors , bonnet , boot , objective ) ;
            SendClientMessage ( playerid , -1 , "[LVehicle]:Engine On" ) ;
            }
        }
    }
    return 1;
}
Taken from my up-coming release.
Y u no move to ZCMD?
Reply
#5

No guys, u don;t understand, i want that command to be modifyed some how, when the car has 0 gas the engine can't be started
Reply
#6

Are you using variable or something to detect if gas is empty?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)