Код:
if(strcmp(cmd, "/engine", true) == 0)
{
if(!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid,COLOR_GREY," You are not in a vehicle!");
return 1;
}
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) { return 1; }
new vehid = GetPlayerVehicleID(playerid);
if(vehid != INVALID_VEHICLE_ID) {
if(Gas[vehid] < 1) {
return SendClientMessage(playerid,COLOR_GREY," That vehicle is out of fuel !");
}
if(IsVehicleTotaled[GetPlayerVehicleID(playerid)] == 1) return SendClientMessage(playerid,COLOR_GREY," This vehicle is totaled!");
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehid,engine,lights,alarm,doors,bonnet,boot,objective);
if(engineOn[vehid] == 0)
{
new cid = PlayerInfo[playerid][pCar][0], cid2 = PlayerInfo[playerid][pCar][1];
new veh = GetPlayerVehicleID(playerid);
if(GetVehNeedHW(vehid, playerid))
{
return SendClientMessage(playerid, COLOR_GRAD2," You do not have the key for this vehicle! ( /(h)ot(w)ire )");
}
if(veh == CarInfo[cid][c_ID] || veh == CarInfo[cid2][c_ID])
{
SetVehicleParamsEx(vehid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
engineOn[vehid] = 1;
playerDisabledEngine[vehid] = 0;
if(PlayerInfo[playerid][pMask])
{
ProxDetector(30.0, playerid, "* Stranger twists the key in the ignition, turning the engine on.", COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else
{
format(string, sizeof(string), "%s twists the key in the ignition, turning the engine on.", PlayerRPName(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
else
{
SendClientMessage(playerid,COLOR_GREY,"You don't own this vehicle !");
}
}
else
{
SetVehicleParamsEx(vehid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
engineOn[vehid] = 0;
playerDisabledEngine[vehid] = 1;
if(PlayerInfo[playerid][pMask]) {
ProxDetector(30.0, playerid, "* Stranger twists the key in the ignition, turning the engine off.", COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else
{
format(string, sizeof(string), "* %s twists the key in the ignition, turning the engine off.", PlayerRPName(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
}
}