02.08.2014, 10:12
I need help, can someone add a selection --Wheels-- to the job?
When you click on the ''wheels'' it opens a menu with all of the wheels in the game. and each set of wheels costs money.
Code-1
code-2
When you click on the ''wheels'' it opens a menu with all of the wheels in the game. and each set of wheels costs money.
Code-1
PHP код:
else if(dialogid == 9) // Mechanic
{
if(response)
{
switch(listitem)
{
case 0: // Repair Vehicle
{
new string[128];
new Float:vH; GetVehicleHealth(GetPlayerVehicleID(playerid), vH);
new Float:vel[3]; GetVehicleVelocity(GetPlayerVehicleID(playerid), vel[0], vel[1], vel[2]);
if(vH < 250) return SendClientMessage(playerid, COLOR_GREY, "The vehicle's engine is too hot to be repaired.");
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You must be in the driver seat to repair a vehicle.");
if(vel[0] != 0 || vel[1] != 0 || vel[2] != 0) return SendClientMessage(playerid, COLOR_GREY, "You can't repair a vehicle while it's moving.");
RepairVehicle(GetPlayerVehicleID(playerid));
PlayerInfo[playerid][pJobSkill][JOB_MECHANIC] ++;
PlayerPlaySound(playerid,1133,0.0,0.0,0.0);
format(string, sizeof(string), "* %s has completely repaired the vehicle they're inside.", RPN(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
}
case 1: // Add/Remove Nitros
{
new string[128];
new Float:vel[3]; GetVehicleVelocity(GetPlayerVehicleID(playerid), vel[0], vel[1], vel[2]);
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You must be in the driver seat to repair a vehicle.");
if(vel[0] != 0 || vel[1] != 0 || vel[2] != 0) return SendClientMessage(playerid, COLOR_GREY, "You can't add/remove nitros to a vehicle while it's moving.");
if(GetVehicleComponentInSlot(GetPlayerVehicleID(playerid),GetVehicleComponentType(1009)) != 1009) // Check if the vehicle has no nitro
{
AddVehicleComponent(GetPlayerVehicleID(playerid),1009);
PlayerPlaySound(playerid,1133,0.0,0.0,0.0);
format(string, sizeof(string), "* %s has installed a 2x nitros cylinder into the vehicle.", RPN(playerid));
}
else
{
RemoveVehicleComponent(GetPlayerVehicleID(playerid),1009);
PlayerPlaySound(playerid,1133,0.0,0.0,0.0);
format(string, sizeof(string), "* %s has removed the nitros cylinders from the vehicle.", RPN(playerid));
}
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
}
case 2: // Add/Remove Hydraulics
{
new string[128];
new Float:vel[3]; GetVehicleVelocity(GetPlayerVehicleID(playerid), vel[0], vel[1], vel[2]);
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You must be in the driver seat to repair a vehicle.");
if(vel[0] != 0 || vel[1] != 0 || vel[2] != 0) return SendClientMessage(playerid, COLOR_GREY, "You can't add/remove nitros to a vehicle while it's moving.");
if(GetVehicleComponentInSlot(GetPlayerVehicleID(playerid),GetVehicleComponentType(1087)) != 1087) // Check if the vehicle has no hydraulics
{
AddVehicleComponent(GetPlayerVehicleID(playerid),1087);
PlayerPlaySound(playerid,1133,0.0,0.0,0.0);
format(string, sizeof(string), "* %s has installed hydraulics system into the vehicle.", RPN(playerid));
}
else
{
RemoveVehicleComponent(GetPlayerVehicleID(playerid),1087);
PlayerPlaySound(playerid,1133,0.0,0.0,0.0);
format(string, sizeof(string), "* %s has removed the hydraulics from the vehicle.", RPN(playerid));
}
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
}
}
}
}
PHP код:
case 9: // Mechanic
{
ShowPlayerDialog(playerid, 9, DIALOG_STYLE_LIST, "Mechanic Tools", "Repair Vehicle\nAdd/Remove Nitros\nAdd/Remove Hydraulics", "Choose", "Cancel");
}