SA-MP Forums Archive
/engine problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /engine problem (/showthread.php?tid=354626)



/engine problem - kidor - 27.06.2012

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;
    }



Re: /engine problem - mineralo - 27.06.2012

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


Re: /engine problem - kidor - 27.06.2012

that command dosen't work


Re: /engine problem - Littlehelper - 27.06.2012

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?


Re: /engine problem - kidor - 27.06.2012

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


Re: /engine problem - Littlehelper - 27.06.2012

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