} else {
SendClientMessage(playerid, -1, "{E74C3C}Error: You are not close to a repairing station! They are marked on the map with a red flag.");
break;
}
CMD:repair(playerid, params[])
{
new vehid = GetPlayerVehicleID(playerid), Float:health, string[128];
GetVehicleHealth(vehid, Float:health);
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{E74C3C}Error: You must be in a vehicle in order to repair a vehicle!");
if(Float:health == 1000) return SendClientMessage(playerid, -1, "{E74C3C}Error: Your vehicle is already fully repaired!");
for (new i = 0; i < sizeof (GasStations); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 75.0, GasStations[i][gX], GasStations[i][gY], GasStations[i][gZ]))
{
new Float:price = 1000-Float:health;
format(string, sizeof(string), "{2ECC71}You have successfully repaired your vehicle for {FFFFFF}$%1.0f", floatmul(Float:price, 5));
SendClientMessage(playerid, -1, string);
PlayerData[playerid][Money] += floatround(floatmul(Float:price, 5), floatround_ceil);
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, PlayerData[playerid][Money]);
RepairVehicle(GetPlayerVehicleID(playerid));
} else {
SendClientMessage(playerid, -1, "{E74C3C}Error: You are not close to a repairing station! They are marked on the map with a red flag.");
break;
}
}
return 1;
}
CMD:repair(playerid, params[])
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{E74C3C}Error: You must be in a vehicle in order to repair a vehicle!");
new vehid = GetPlayerVehicleID(playerid), Float:health, string[128];
GetVehicleHealth(vehid, health);
if(health == 1000) return SendClientMessage(playerid, -1, "{E74C3C}Error: Your vehicle is already fully repaired!");
new bool:in_range;
for (new i = 0; i < sizeof (GasStations); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 75.0, GasStations[i][gX], GasStations[i][gY], GasStations[i][gZ]))
{
new Float:price = 1000-health;
format(string, sizeof(string), "{2ECC71}You have successfully repaired your vehicle for {FFFFFF}$%1.0f", floatmul(Float:price, 5));
SendClientMessage(playerid, -1, string);
PlayerData[playerid][Money] += floatround(floatmul(price, 5), floatround_ceil);
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, PlayerData[playerid][Money]);
RepairVehicle(GetPlayerVehicleID(playerid));
in_range = true;
return 1;
}
}
if (!in_range) SendClientMessage(playerid, -1, "{E74C3C}Error: You are not close to a repairing station! They are marked on the map with a red flag.");
return 1;
}
Yeah, you should use a variable and set it to true/1 if the gas station is found or else it'll be by default false/0. So after the loop, you can send that message.
PHP код:
|