SA-MP Forums Archive
cmd:killengine - 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: cmd:killengine (/showthread.php?tid=490426)



cmd:killengine - matthew1211 - 26.01.2014

does anyone know how to make a cmd called /killengine to stop cars


Re : cmd:killengine - MCZOFT - 26.01.2014

Do you mean to stop the engine or to kill it so it cannot be in ON STATUS anymore ?


Re: cmd:killengine - matthew1211 - 26.01.2014

yes, it be kill /car engine but it forces the engine off rather then on and off


Re : cmd:killengine - MCZOFT - 26.01.2014

PHP код:
#define GREY 0xCECECEFF 
PHP код:
new Engine[MAX_VEHICLES], Lights[MAX_VEHICLES]; 
Somewhere in ur script

PHP код:
Engine[vehicleid] = 0;
Lights[vehicleid] = 0
PHP код:
command(engineoffplayeridparams[])//This bit is creating the command
{
    
#pragma unused params
    
if(GetPlayerState(playerid) == 2//This bit is checking the players seat
    
{
        new 
vehicle GetPlayerVehicleID(playerid);
        if(
Engine[vehicle] == 1)
        {
            new 
enginelightsalarmdoorsbonnetbootobjective//Same procedure, this is defining the variables
            
Engine[vehicle] = 0//This bit here, is quite vital. because if you left it at: Engine[vehicle] = 0; Then the vehicle would turn off, then not start again unless respawned.
            
GetVehicleParamsEx(vehicleenginelightsalarmdoorsbonnetbootobjective);//This bit is checking the current status of the vehicles.
            
SetVehicleParamsEx(vehicle0lightsalarmdoorsbonnetboot0);//This bit is setting the engine to be turned off.
        
}
        else return 
SendClientMessage(playeridGREY"This vehicle's engine is already off.");//This will display on the screen if the engine is already off.
    
}
    else return 
SendClientMessage(playeridGREY"You must be in the drivers seat of a vehicle.");//This message will display on the screen if the player doing the command isn't in the drivers seat of a vehicle
    
return 1;




Re: cmd:killengine - Flake. - 26.01.2014

pawn Код:
new engine,lights,alarm,doors,bonnet,boot,objective;

if(strcmp(cmd, "/stopengine",true) == 0) {
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID) {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
        }
        return 1;
    }
Although this might not be exactly what you're looking for i'm sure you can edit it.

Credits to test_cmds.pwn


Edit: o looks like MCZOFT got to it before me, good luck