CMD:repair(playerid,params[])
{
new userID;
new giveplayer[MAX_PLAYER_NAME];
new sendername[MAX_PLAYER_NAME];
new moneys, string[256];
if(IsPlayerConnected(playerid))
{
if(playerVariables[playerid][pJob] != 3)
{
SendClientMessage(playerid, COLOR_GREY, "You are not a mechanic.");
return 1;
}
if(sscanf(params, "ui", userID, moneys))
{
return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/repair [playerid] [money]");
}
if(moneys < 1 || moneys > 15000) { SendClientMessage(playerid, COLOR_GREY, "The money must be until 15000$."); return 1; }
if(IsPlayerConnected(userID))
{
if(userID != INVALID_PLAYER_ID)
{
if(IsPlayerInAnyVehicle(userID))
{
GetPlayerName(userID, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "You offerd %s to fix his car for $%d.",giveplayer,moneys);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), " Car Mechanic %s wants to repair your car for $%d,(type /accept repair to accept).",sendername,moneys);
SendClientMessage(userID, COLOR_WHITE, string);
RepairOffer[userID] = playerid;
RepairPrice[userID] = moneys;
}
}
}
}
return 1;
}
if(userID == playerid)
return SendClientMessage(playerid, COLOR_GREY, "You can't repair yourself.");
Just add this somewhere in the command after you extract the params.
pawn Код:
|
CMD:repair(playerid,params[])
{
new userID;
new giveplayer[MAX_PLAYER_NAME];
new sendername[MAX_PLAYER_NAME];
new moneys, string[256];
if(IsPlayerConnected(playerid))
{
if(playerVariables[playerid][pJob] != 3)
{
SendClientMessage(playerid, COLOR_GREY, "You are not a mechanic.");
return 1;
}
if(sscanf(params, "ui", userID, moneys))
{
return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/repair [playerid] [money]");
}
if(userID == playerid)
return SendClientMessage(playerid, COLOR_GREY, "You can't repair yourself.");
if(moneys < 1 || moneys > 15000) { SendClientMessage(playerid, COLOR_GREY, "The money must be until 15000$."); return 1; }
if(IsPlayerConnected(userID))
{
if(userID != INVALID_PLAYER_ID)
{
if(IsPlayerInAnyVehicle(userID))
{
GetPlayerName(userID, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "You offerd %s to fix his car for $%d.",giveplayer,moneys);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), " Car Mechanic %s wants to repair your car for $%d,(type /accept repair to accept).",sendername,moneys);
SendClientMessage(userID, COLOR_WHITE, string);
RepairOffer[userID] = playerid;
RepairPrice[userID] = moneys;
}
}
}
}
return 1;
}
Just add this line above the money check:
if(userID == playerid) return SendClientMessage(playerid, COLOR_GREY, "You can't repair your own can."); |
Yes, just hit tab on the line with the "return SendClientMessage(playerid, COLOR_GREY, "You can't repair yourself.")"
Glad I could help you! |
Just add this line above the money check:
if(userID == playerid) return SendClientMessage(playerid, COLOR_GREY, "You can't repair your own can."); |