cmd:killengine
#1

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

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

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

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;

Reply
#5

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
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)