/contract cmd help
#1

I need to add reason here /contract [id] [amount] [reason]
Anybody Add Please
pawn Код:
if(strcmp(cmd, "/contract", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pLevel] >= 2)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /contract [playerid/PartOfName] [amount]");
                    return 1;
                }
                giveplayerid = ReturnUser(tmp);
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /contract [playerid/PartOfName] [amount]");
                    return 1;
                }
                moneys = strvalEx(tmp);
                if(moneys < 10000 || moneys > 100000) { SendClientMessage(playerid, COLOR_GREY, "   Contract money must be at least $10,000, and not more then $100,000 !"); return 1; }
                if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8) { SendClientMessage(playerid, COLOR_GREY, "   Hitmen cannot place contracts on people !"); return 1; }
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        if(giveplayerid == playerid)
                        {
                        SendClientMessage(playerid, COLOR_GREY, "   You cannot Contract yourself !");
                        return 1;
                        }
                        if(PlayerInfo[giveplayerid][pHeadValue] > 500000) { SendClientMessage(playerid, COLOR_GREY, "   That player has the maximum amount on their head !"); return 1; }
                        if(IsACop(giveplayerid) && moneys < 100000) { SendClientMessage(playerid, COLOR_GREY, "   Contract price must be atleast $100,000 for Cops !"); return 1; }
                        if(PlayerTied[playerid] != 0 || PlayerCuffed[playerid] != 0) { SendClientMessage(playerid, COLOR_GREY, "   You can't do that at this time !"); return 1; }
                        new playermoney = PlayerInfo[playerid][pCash];
                        if(moneys > 0 && playermoney >= moneys)
                        {
                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                            format(string, sizeof(string), "%s", sendername);
                            strmid(PlayerInfo[giveplayerid][pContractBy], string, 0, strlen(string), 255);
                            PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-moneys;
                            GivePlayerMoney(playerid, (0 - moneys));
                            PlayerInfo[giveplayerid][pHeadValue] +=moneys;
                            format(string, sizeof(string), "%s has placed a contract on %s, for $%d.",sendername, giveplayer, moneys);
                            SendFamilyMessage(8, COLOR_YELLOW, string);
                            ABroadCast(COLOR_YELLOW,string,4);
                            format(string, sizeof(string), "* You placed a contract on %s, for $%d.",giveplayer, moneys);
                            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GRAD1, "   Invalid transaction amount !");
                        }
                    }
                }
                else
                {
                    format(string, sizeof(string), "   %d is not an active player !", giveplayerid);
                    SendClientMessage(playerid, COLOR_GRAD1, string);
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   You must be atleast level 2 to place a Contract !");
            }
        }
        return 1;
    }
    return 1;
}
Reply
#2

Quote:
Originally Posted by venice
Посмотреть сообщение
I need to add reason here /contract [id] [amount] [reason]
Anybody Add Please
pawn Код:
if(strcmp(cmd, "/contract", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pLevel] >= 2)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /contract [playerid/PartOfName] [amount]");
                    return 1;
                }
                giveplayerid = ReturnUser(tmp);
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /contract [playerid/PartOfName] [amount]");
                    return 1;
                }
                moneys = strvalEx(tmp);
                if(moneys < 10000 || moneys > 100000) { SendClientMessage(playerid, COLOR_GREY, "   Contract money must be at least $10,000, and not more then $100,000 !"); return 1; }
                if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8) { SendClientMessage(playerid, COLOR_GREY, "   Hitmen cannot place contracts on people !"); return 1; }
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        if(giveplayerid == playerid)
                        {
                        SendClientMessage(playerid, COLOR_GREY, "   You cannot Contract yourself !");
                        return 1;
                        }
                        if(PlayerInfo[giveplayerid][pHeadValue] > 500000) { SendClientMessage(playerid, COLOR_GREY, "   That player has the maximum amount on their head !"); return 1; }
                        if(IsACop(giveplayerid) && moneys < 100000) { SendClientMessage(playerid, COLOR_GREY, "   Contract price must be atleast $100,000 for Cops !"); return 1; }
                        if(PlayerTied[playerid] != 0 || PlayerCuffed[playerid] != 0) { SendClientMessage(playerid, COLOR_GREY, "   You can't do that at this time !"); return 1; }
                        new playermoney = PlayerInfo[playerid][pCash];
                        if(moneys > 0 && playermoney >= moneys)
                        {
                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                            format(string, sizeof(string), "%s", sendername);
                            strmid(PlayerInfo[giveplayerid][pContractBy], string, 0, strlen(string), 255);
                            PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-moneys;
                            GivePlayerMoney(playerid, (0 - moneys));
                            PlayerInfo[giveplayerid][pHeadValue] +=moneys;
                            format(string, sizeof(string), "%s has placed a contract on %s, for $%d.",sendername, giveplayer, moneys);
                            SendFamilyMessage(8, COLOR_YELLOW, string);
                            ABroadCast(COLOR_YELLOW,string,4);
                            format(string, sizeof(string), "* You placed a contract on %s, for $%d.",giveplayer, moneys);
                            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GRAD1, "   Invalid transaction amount !");
                        }
                    }
                }
                else
                {
                    format(string, sizeof(string), "   %d is not an active player !", giveplayerid);
                    SendClientMessage(playerid, COLOR_GRAD1, string);
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   You must be atleast level 2 to place a Contract !");
            }
        }
        return 1;
    }
    return 1;
}
pawn Код:
if(strcmp(cmd, "/contract", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pLevel] >= 2)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /contract [playerid/PartOfName] [amount]");
                    return 1;
                }
                giveplayerid = ReturnUser(tmp);
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /contract [playerid/PartOfName] [amount]");
                    return 1;
                }
new length = strlen(cmdtext);
    while ((idx < length) && (cmdtext[idx] <= ' '))
    {
      idx++;
    }
    new offset = idx;
    new text[64];
    while ((idx < length) && ((idx - offset) < (sizeof(text) - 1)))
    {
      text[idx - offset] = cmdtext[idx];
      idx++;
    }
    text[idx - offset] = EOS;
    if(!strlen(text)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /contract etc...");
                moneys = strvalEx(tmp);
                if(moneys < 10000 || moneys > 100000) { SendClientMessage(playerid, COLOR_GREY, "   Contract money must be at least $10,000, and not more then $100,000 !"); return 1; }
                if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8) { SendClientMessage(playerid, COLOR_GREY, "   Hitmen cannot place contracts on people !"); return 1; }
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        if(giveplayerid == playerid)
                        {
                        SendClientMessage(playerid, COLOR_GREY, "   You cannot Contract yourself !");
                        return 1;
                        }
                        if(PlayerInfo[giveplayerid][pHeadValue] > 500000) { SendClientMessage(playerid, COLOR_GREY, "   That player has the maximum amount on their head !"); return 1; }
                        if(IsACop(giveplayerid) && moneys < 100000) { SendClientMessage(playerid, COLOR_GREY, "   Contract price must be atleast $100,000 for Cops !"); return 1; }
                        if(PlayerTied[playerid] != 0 || PlayerCuffed[playerid] != 0) { SendClientMessage(playerid, COLOR_GREY, "   You can't do that at this time !"); return 1; }
                        new playermoney = PlayerInfo[playerid][pCash];
                        if(moneys > 0 && playermoney >= moneys)
                        {
                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                            format(string, sizeof(string), "%s", sendername);
                            strmid(PlayerInfo[giveplayerid][pContractBy], string, 0, strlen(string), 255);
                            PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-moneys;
                            GivePlayerMoney(playerid, (0 - moneys));
                            PlayerInfo[giveplayerid][pHeadValue] +=moneys;
                            format(string, sizeof(string), "%s has placed a contract on %s, for $%d.",sendername, giveplayer, moneys);
                            SendFamilyMessage(8, COLOR_YELLOW, string);
                            ABroadCast(COLOR_YELLOW,string,4);
                            format(string, sizeof(string), "* You placed a contract on %s, for $%d.",giveplayer, moneys);
                            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GRAD1, "   Invalid transaction amount !");
                        }
                    }
                }
                else
                {
                    format(string, sizeof(string), "   %d is not an active player !", giveplayerid);
                    SendClientMessage(playerid, COLOR_GRAD1, string);
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   You must be atleast level 2 to place a Contract !");
            }
        }
        return 1;
    }
    return 1;
}

SORRY FOR BAD INDENTATION
It's something like that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)