Problem /repair command
#2

pawn Код:
CMD:repair(playerid,params[])
{
    if(!IsPlayerConnected(playerid)) return 1;
    if(playerVariables[playerid][pJob] != 3) return SendClientMessage(playerid, COLOR_GREY, "You are not a mechanic.");
    new userID, moneys;
    if(sscanf(params, "ui", userID, moneys)) return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/repair [playerid] [money]");
    if(!(0 < moneys < 15001)) return SendClientMessage(playerid, COLOR_GREY, "The money must be between $1 and $15000.");
    if(!IsPlayerConnected(userID) || userID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "User is not connected.");
    if(userID == playerid) return SendClientMessage(playerid, COLOR_GREY, "You cannot offer services to yourself.");
    if(!IsPlayerInAnyVehicle(userID)) return SendClientMessage(playerid, COLOR_GREY, "This player is not in a vehicle.");
    new giveplayer[MAX_PLAYER_NAME], string[110];
    GetPlayerName(userID, giveplayer, sizeof(giveplayer));
    format(string, sizeof(string), "You offered to fix %s's car for $%d.", giveplayer, moneys);
    SendClientMessage(playerid, COLOR_WHITE, string);
    GetPlayerName(playerid, giveplayer, sizeof(giveplayer));
    format(string, sizeof(string), " Car Mechanic %s wants to repair your car for $%d,(type /accept repair to accept).", giveplayer, moneys);
    SendClientMessage(userID, COLOR_WHITE, string);
    RepairOffer[userID] = playerid;
    RepairPrice[userID] = moneys;
    return 1;
}
EDIT:
pawn Код:
if(userID == playerid)
This line will check if the ID that you entered (userID) is the same as the ID of the player who typed the command (playerid), A.K.A. you.
Reply


Messages In This Thread
Problem /repair command - by buburuzu19 - 09.09.2014, 06:39
Re: Problem /repair command - by Threshold - 09.09.2014, 07:21

Forum Jump:


Users browsing this thread: 2 Guest(s)