25.05.2012, 00:39
This should cover your /engineon and /engineoff commands;
Best regards,
Jesse
pawn Код:
new IsEngineOn[MAX_VEHICLES];
CMD:engine(playerid, params[])
{
new vehicle, string[128], engine, lights, alarm, doors, bonnent, boot, objective;
vehicle = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnent, boot, objective);
if(!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, COLOR_RED, "You are not in any vehicle!");
return 1;
}
if(IsEngineOn[vehicle] == 0)
{
SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnent, boot, objective);
IsEngineOn[vehicle] = 1;
format(string, sizeof(string), "%s puts their keys in the ignition and starts the car.", GetName(playerid));
}
else if(IsEngineOn[vehicle] == 1)
{
SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnent, boot, objective);
IsEngineOn[vehicle] = 0;
format(string, sizeof(string), "%s takes their keys out of the ignition and shuts off the car.", GetName(playerid));
}
ProxDetector(30, playerid, string, COLOR_PURPLE);
return 1;
}
Jesse