Код HTML:
CMD:repair(playerid, params[])
{
new string[256], playerb, price;
if(!IsPlayerLogged(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(sscanf(params, "us[64]", playerb, price)) return SendClientMessageEx(playerid, COLOR_WHITE, "[Usage]: /repair [playerid] [price]");
if(PlayerInfo[playerid][pMoney] < 500) return SendClientMessage(playerid, COLOR_ERROR, "You must have at least $500 on you to repair a car.");
if(PlayerInfo[playerid][pJob] != JOB_MECHANIC) return SendClientMessage(playerid, COLOR_GREY, "You are not a mechanic.");
if(playerid == playerb)
{
if(sscanf(params, "us[64]", playerb, price)) return SendClientMessageEx(playerid, COLOR_WHITE, "[Usage]: /repair [playerid] [price]");
if(PlayerInfo[playerid][pJob] != JOB_MECHANIC) return SendClientMessage(playerid, COLOR_GREY, "You are not a mechanic.");
if(!IsPlayerLogged(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(price < 500 || price > 5000) return SendClientMessage(playerid, COLOR_ERROR, "Price number can't be below 500 or higher than 5000.");
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_ERROR, "You must be inside a vehicle.");
else if(gettime() - PlayerMuteInfo[playerid][RepairCool] < 0)
{
format(string, sizeof(string), "Please wait %i seconds before repairing again.", PlayerMuteInfo[playerid][RepairCool] - gettime());
return SendClientMessageEx(playerid, COLOR_LIGHTRED, string);
}
xGivePlayerMoney(playerid, -price);
RepairVehicle(GetPlayerVehicleID(playerb));
PlayerPlaySound(playerid,1133,0.0,0.0,0.0);
PlayerPlaySound(playerb,1133,0.0,0.0,0.0);
}
else if(gettime() - PlayerMuteInfo[playerid][RepairCool] < 0)
{
format(string, sizeof(string), "Please wait %i seconds before repairing again.", PlayerMuteInfo[playerid][RepairCool] - gettime());
return SendClientMessageEx(playerid, COLOR_LIGHTRED, string);
}
if(price < 500 || price > 5000) return SendClientMessage(playerid, COLOR_ERROR, "Price number can't be below 500 or higher than 5000.");
if(!IsPlayerLogged(playerb)) return SendClientMessage(playerid, COLOR_ERROR, "Invalid player id.");
// if(PlayerInfo[playerid][pLevel] < 2) return SendClientMessage(playerid, COLOR_ERROR, "You must be at least level 2 to sell weapons.");
if(IsPlayerNearby(playerid, playerb, 4)) return SendClientMessage(playerid, COLOR_ERROR, "You are too far away from that player.");
SellRepairTo[playerid] = playerb;
BuyRepairFrom[playerb] = playerid;
BuyRepairPrice[playerb] = price;
PlayerMuteInfo[playerid][RepairCool] = gettime() + 60;
format(string, sizeof(string), " You have offered %s to repair their car for $%d.", GetPlayerNameEx(playerb), price);
SendClientMessage(playerid, COLOR_GREY, string);
format(string, sizeof(string), " %s has offered to repair your car for $%d. (/accept repair) (/cancel repair)", GetPlayerNameEx(playerid), price);
SendClientMessage(playerb, COLOR_GREY, string);
TextDrawShowForPlayer(playerb,RepairOffer);
SetTimer("OfferedRepair", 4000, false);
return 1;
}