case 4: // Vehicle option dialog
{
switch(response)
{
case 1: // Selecting
{
switch(listitem)
{
case 0: // Toggle engine
{
if(VehicleInfo[GetPlayerVehicleID(playerid)][vFuel] == 0)
{
TogglePlayerControllableEx(playerid,false);
return SendClientMessage(playerid,COLOR_LIGHTRED,"There is no more fuel in your vehicle.");
}
if(VehicleInfo[GetPlayerVehicleID(playerid)][vWireTime] > 0)
{
RemovePlayerFromVehicleEx(playerid);
return SendClientMessage(playerid,COLOR_LIGHTRED,"You must wait for the vehicle's hotwiring delay to complete !");
}
new Float:ghealth, health;
GetVehicleHealth(GetPlayerVehicleID(playerid),ghealth);
health = floatround(ghealth);
if(health <= 300)
{
RemovePlayerFromVehicleEx(playerid);
return SendClientMessage(playerid,COLOR_LIGHTRED,"The vehicle is currently damaged !");
}
new string[128],sendername[MAX_PLAYER_NAME];
format(sendername, sizeof(sendername), "%s", PlayerNameEx(playerid));
GiveNameSpace(sendername);
switch(VehicleInfo[GetPlayerVehicleID(playerid)][vEngine])
{
case 0:
{
format(string, sizeof(string), "Attempting to start the %ss engine.", VehicleName[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
SendClientMessage(playerid, COLOR_WHITE, string);
new RandomStart;
RandomStart = random(4);
switch(RandomStart)
{
case 0,1,2:
{
VehicleInfo[GetPlayerVehicleID(playerid)][vEngine] = 1;
CarEngine(GetPlayerVehicleID(playerid),1);
TogglePlayerControllableEx(playerid,true);
format(string, sizeof(string), "%ss engine turned [ON]", VehicleName[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
SendClientMessage(playerid, COLOR_WHITE, string);
CarLights(GetPlayerVehicleID(playerid),1);
new key = VehicleInfo[GetPlayerVehicleID(playerid)][vOwned];
if(key != SCRIPT_CARS)
{
if(CarInfo[key][cBomb] == 1)
{
new Float:X, Float:Y, Float:Z, vehicleid = GetPlayerVehicleID(playerid);
GetVehiclePos(vehicleid, X, Y, Z);
SetVehicleVelocity(vehicleid, 0, 0, 0.2);
SendFactionMessage(4, COLOR_PINK, "HQ: All Units - HQ: Vehicle explosion.");
format(string, sizeof(string), "HQ: Location: %s", GetZone(X, Y, Z));
SendFactionMessage(4, COLOR_PINK, string);
CreateFire(X, Y, Z, 0, 0);
CreateExplosion(X, Y, Z, 12, 15.0);
CreateExplosion(X, Y, Z, 12, 15.0);
foreach (Player,i)
{
if(GetPVarInt(i, "PlayerLogged") == 1 && GetPlayerVehicleID(i) == vehicleid)
{
SetPlayerPos(i, X, Y, Z+0.5);
SetPlayerHealth(i,1.0);
SetPlayerHealth(i,0.0);
}
}
SetVehicleHealth(vehicleid, 15.0);
CarInfo[key][cBomb]=0;
CarInfo[key][cHealth]=15.0;
SaveCars();
SaveCars2();
}
}
}
case 3:
{
format(string, sizeof(string), "The attempt to start the %ss engine has failed !", VehicleName[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
SendClientMessage(playerid, COLOR_WHITE, string);
ShowPlayerDialog(playerid,4,DIALOG_STYLE_LIST,"Vehicle Options","{33FF66}Toggle Engine\n{33FF66}Idle\n{33FF66}Lights\n{33FF66}Exit Vehicle","Continue", "Cancel");
}
}
}
case 1:
{
VehicleInfo[GetPlayerVehicleID(playerid)][vEngine] = 0;
CarEngine(GetPlayerVehicleID(playerid),0);
ShowPlayerDialog(playerid,4,DIALOG_STYLE_LIST,"Vehicle Options","{33FF66}Toggle Engine\n{33FF66}Idle\n{33FF66}Lights\n{33FF66}Exit Vehicle","Continue", "Cancel");
format(string, sizeof(string), "%ss engine turned [OFF]", VehicleName[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
SendClientMessage(playerid, COLOR_WHITE, string);
CarLights(GetPlayerVehicleID(playerid),2);
}
}
}
case 1: // IDLE
{
new Float:health;
GetVehicleHealth(GetPlayerVehicleID(playerid),health);
if(health < 300.0) return SendClientMessage(playerid,COLOR_WHITE,"You can't idle in a damaged vehicle.");
if(VehicleInfo[GetPlayerVehicleID(playerid)][vFuel] == 0)
{
TogglePlayerControllableEx(playerid,false);
return SendClientMessage(playerid,COLOR_LIGHTRED,"There is no more fuel in the vehicle !");
}
if(VehicleInfo[GetPlayerVehicleID(playerid)][vEngine] == 0) SendClientMessage(playerid,COLOR_WHITE,"You are now idle inside your vehicle, remember to use /vehicle.");
else SendClientMessage(playerid,COLOR_WHITE,"Your engine needs to be off to use this option.");
}
case 2: // Lights
{
if(VehicleInfo[GetPlayerVehicleID(playerid)][vFuel] == 0)
{
TogglePlayerControllableEx(playerid,false);
return SendClientMessage(playerid,COLOR_LIGHTRED,"There is no more fuel in the vehicle !");
}
if(VehicleInfo[GetPlayerVehicleID(playerid)][vEngine] == 0)
{
SendClientMessage(playerid,COLOR_WHITE,"This vehicle's engine is off.");
return TogglePlayerControllableEx(playerid,false);
}
switch(VehicleInfo[GetPlayerVehicleID(playerid)][vLights])
{
case 1:
{
CarLights(GetPlayerVehicleID(playerid),2);
GameTextForPlayer(playerid, "~w~Lights~n~~r~Off", 4000, 3);
}
case 2:
{
CarLights(GetPlayerVehicleID(playerid),1);
GameTextForPlayer(playerid, "~w~Lights~n~~g~On", 4000, 3);
}
}
}
case 3: // Exit Car
{
SendClientMessage(playerid,COLOR_WHITE,"You left the vehicle.");
TogglePlayerControllableEx(playerid,true);
RemovePlayerFromVehicleEx(playerid);
}
}
}
}
}