26.01.2014, 15:38
PHP код:
#define GREY 0xCECECEFF
PHP код:
new Engine[MAX_VEHICLES], Lights[MAX_VEHICLES];
PHP код:
Engine[vehicleid] = 0;
Lights[vehicleid] = 0;
PHP код:
command(engineoff, playerid, params[])//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 engine, lights, alarm, doors, bonnet, boot, objective; //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(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);//This bit is checking the current status of the vehicles.
SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, 0);//This bit is setting the engine to be turned off.
}
else return SendClientMessage(playerid, GREY, "This vehicle's engine is already off.");//This will display on the screen if the engine is already off.
}
else return SendClientMessage(playerid, GREY, "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;
}