Need help with if's and else's
#1

hey guys im working on this command but whenever im not in range of the point it still takes money from me
pawn Code:
COMMAND:repairvehicle(playerid, params[]) // repair vehicle for $175 at mechanic
{
  if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic] You are not in a vehicle! ))");
  if(GetPlayerMoney(playerid) < 175) return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic] You don't have the money to perform this action! ))");
  if(IsPlayerInRangeOfPoint(playerid, 25.0,2460.5691,-2118.7847,13.5530))
  SendClientMessage(playerid, 0x3524C9FF, "(( [Mechanic] Vehicle repaired for $175! ))");
  GivePlayerMoney(playerid, -175);
  RepairVehicle(GetPlayerVehicleID(playerid));
  return 1;
}
Reply
#2

pawn Code:
COMMAND:repairvehicle(playerid, params[]) // repair vehicle for $175 at mechanic
{
  if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic] You are not in a vehicle! ))");
  if(GetPlayerMoney(playerid) < 175) return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic] You don't have the money to perform this action! ))");
  if(IsPlayerInRangeOfPoint(playerid, 25.0,2460.5691,-2118.7847,13.5530))
{
  SendClientMessage(playerid, 0x3524C9FF, "(( [Mechanic] Vehicle repaired for $175! ))");
  GivePlayerMoney(playerid, -175);
  RepairVehicle(GetPlayerVehicleID(playerid));
}
  return 1;
}
Or
pawn Code:
COMMAND:repairvehicle(playerid, params[]) // repair vehicle for $175 at mechanic
{
  if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic] You are not in a vehicle! ))");
  if(GetPlayerMoney(playerid) < 175) return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic] You don't have the money to perform this action! ))");
  if(!IsPlayerInRangeOfPoint(playerid, 25.0,2460.5691,-2118.7847,13.5530))return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic]You are not in the repair area! ))");
  SendClientMessage(playerid, 0x3524C9FF, "(( [Mechanic] Vehicle repaired for $175! ))");
  GivePlayerMoney(playerid, -175);
  RepairVehicle(GetPlayerVehicleID(playerid));
  return 1;
}
Reply
#3

Quote:
Originally Posted by DaRk_RaiN
View Post
pawn Code:
COMMAND:repairvehicle(playerid, params[]) // repair vehicle for $175 at mechanic
{
  if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic] You are not in a vehicle! ))");
  if(GetPlayerMoney(playerid) < 175) return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic] You don't have the money to perform this action! ))");
  if(IsPlayerInRangeOfPoint(playerid, 25.0,2460.5691,-2118.7847,13.5530))
{
  SendClientMessage(playerid, 0x3524C9FF, "(( [Mechanic] Vehicle repaired for $175! ))");
  GivePlayerMoney(playerid, -175);
  RepairVehicle(GetPlayerVehicleID(playerid));
}
  return 1;
}
Or
pawn Code:
COMMAND:repairvehicle(playerid, params[]) // repair vehicle for $175 at mechanic
{
  if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic] You are not in a vehicle! ))");
  if(GetPlayerMoney(playerid) < 175) return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic] You don't have the money to perform this action! ))");
  if(!IsPlayerInRangeOfPoint(playerid, 25.0,2460.5691,-2118.7847,13.5530))return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic]You are not in the repair area! ))");
  SendClientMessage(playerid, 0x3524C9FF, "(( [Mechanic] Vehicle repaired for $175! ))");
  GivePlayerMoney(playerid, -175);
  RepairVehicle(GetPlayerVehicleID(playerid));
  return 1;
}
How do i make so that when they're not in range they will get a message?
Reply
#4

I just told you xD anyways
pawn Code:
COMMAND:repairvehicle(playerid, params[]) // repair vehicle for $175 at mechanic
{
  if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic] You are not in a vehicle! ))");
  if(GetPlayerMoney(playerid) < 175) return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic] You don't have the money to perform this action! ))");
  if(!IsPlayerInRangeOfPoint(playerid, 25.0,2460.5691,-2118.7847,13.5530))return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic]You are not in the repair area! ))");//Here it is.
  SendClientMessage(playerid, 0x3524C9FF, "(( [Mechanic] Vehicle repaired for $175! ))");
  GivePlayerMoney(playerid, -175);
  RepairVehicle(GetPlayerVehicleID(playerid));
  return 1;
}
Reply
#5

Quote:
Originally Posted by DaRk_RaiN
View Post
pawn Code:
COMMAND:repairvehicle(playerid, params[]) // repair vehicle for $175 at mechanic
{
  if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic] You are not in a vehicle! ))");
  if(GetPlayerMoney(playerid) < 175) return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic] You don't have the money to perform this action! ))");
  if(IsPlayerInRangeOfPoint(playerid, 25.0,2460.5691,-2118.7847,13.5530))
{
  SendClientMessage(playerid, 0x3524C9FF, "(( [Mechanic] Vehicle repaired for $175! ))");
  GivePlayerMoney(playerid, -175);
  RepairVehicle(GetPlayerVehicleID(playerid));
}
  return 1;
}
Or
pawn Code:
COMMAND:repairvehicle(playerid, params[]) // repair vehicle for $175 at mechanic
{
  if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic] You are not in a vehicle! ))");
  if(GetPlayerMoney(playerid) < 175) return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic] You don't have the money to perform this action! ))");
  if(!IsPlayerInRangeOfPoint(playerid, 25.0,2460.5691,-2118.7847,13.5530))return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic]You are not in the repair area! ))");
  SendClientMessage(playerid, 0x3524C9FF, "(( [Mechanic] Vehicle repaired for $175! ))");
  GivePlayerMoney(playerid, -175);
  RepairVehicle(GetPlayerVehicleID(playerid));
  return 1;
}
Sorry i didnt see ur message, +rep 4 you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)