Help [repair]
#1

Hello

i want make this cmd repair , when he try to repair herself can't..
+rep for help.

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(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;
}
Thanks.
Reply
#2

Just add this somewhere in the command after you extract the params.

pawn Код:
if(userID == playerid)
     return SendClientMessage(playerid, COLOR_GREY, "You can't repair yourself.");
Reply
#3

Just add this line above the money check:
if(userID == playerid) return SendClientMessage(playerid, COLOR_GREY, "You can't repair your own can.");
Reply
#4

Quote:
Originally Posted by Chenko
Посмотреть сообщение
Just add this somewhere in the command after you extract the params.

pawn Код:
if(userID == playerid)
     return SendClientMessage(playerid, COLOR_GREY, "You can't repair yourself.");
thanks for answer bro,and help.

Like it ?
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;
}
Quote:
Originally Posted by Berzerk
Посмотреть сообщение
Just add this line above the money check:
if(userID == playerid) return SendClientMessage(playerid, COLOR_GREY, "You can't repair your own can.");
u are funny =)))))
Reply
#5

Yes, just hit tab on the line with the "return SendClientMessage(playerid, COLOR_GREY, "You can't repair yourself.")"

Glad I could help you!
Reply
#6

Put it in the same line, not under it.
Reply
#7

Quote:
Originally Posted by Chenko
Посмотреть сообщение
Yes, just hit tab on the line with the "return SendClientMessage(playerid, COLOR_GREY, "You can't repair yourself.")"

Glad I could help you!
Thanks Bro , +rep.
Reply
#8

Quote:
Originally Posted by Berzerk
Посмотреть сообщение
Just add this line above the money check:
if(userID == playerid) return SendClientMessage(playerid, COLOR_GREY, "You can't repair your own can.");
Car* xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)