Please help me !
#5

At the top of your script:

pawn Код:
new bounty[MAX_PLAYERS];
And these are the commands:

pawn Код:
if(strcmp(cmd, "/hitman", true) == 0) {
        new tmp[256];
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, WHITE, "USAGE: /hitman [playerid] [amount]");
            return 1;
        }
        giveplayerid = strval(tmp);

        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) {
            SendClientMessage(playerid, WHITE, "USAGE: /hitman [playerid] [amount]");
            return 1;
        }
        moneys = strval(tmp);

        if(moneys > GetPlayerMoney(playerid)) {
            SendClientMessage(playerid, RED, "You don't have enough money!");
            return 1;
        }
        if(moneys < 1) {
            SendClientMessage(playerid, YELLOW, "You need money to place a bounty.");
            return 1;
        }
        if(IsPlayerConnected(giveplayerid)==0) {
            SendClientMessage(playerid, RED, "That is not a connected player.");
            return 1;
        }

        bounty[giveplayerid]+=moneys;
        GivePlayerMoney(playerid, 0-moneys);

        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
        GetPlayerName(playerid, sendername, sizeof(sendername));

        format(string, sizeof(string), "%s has had a $%d bounty put on his head from %s (total: $%d).", giveplayer, moneys, sendername, bounty[giveplayerid]);
        SendClientMessageToAll(ORANGE, string);

        format(string, sizeof(string), "You have had a $%d bounty put on you from %s (id: %d).", moneys, sendername, playerid);
        SendClientMessage(giveplayerid, RED, string);

        return 1;
    }
    if(strcmp(cmd, "/bounty", true) == 0) {
        new tmp[256];
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, WHITE, "USAGE: /bounty [playerid]");
            return 1;
        }
        giveplayerid = strval(tmp);

        if(IsPlayerConnected(giveplayerid)) {
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            format(string, sizeof(string), "Player %s (id: %d) has a  $%d bounty on his head.", giveplayer,giveplayerid,bounty[giveplayerid]);
            SendClientMessage(playerid, YELLOW, string);
        } else {
            SendClientMessage(playerid, RED, "No such player exists!");
        }

        return 1;
    }
    if(strcmp(cmd, "/bounties", true) == 0)
    {
        new x;

        SendClientMessage(playerid, GREEN, "Current Bounties:");
        for(new i=0; i < MAX_PLAYERS; i++) {
            if(IsPlayerConnected(i) && bounty[i] > 0) {
                GetPlayerName(i, giveplayer, sizeof(giveplayer));
                format(string, sizeof(string), "%s%s(%d): $%d", string,giveplayer,i,bounty[i]);

                x++;
                if(x > 3) {
                    SendClientMessage(playerid, YELLOW, string);
                    x = 0;
                    format(string, sizeof(string), "");
                } else {
                    format(string, sizeof(string), "%s, ", string);
                }
            }
        }

        if(x <= 3 && x > 0) {
            string[strlen(string)-2] = '.';
            SendClientMessage(playerid, YELLOW, string);
        }

        return 1;
    }
Reply


Messages In This Thread
Please help me ! - by NewbBeginner - 21.11.2010, 17:36
Re: Please help me ! - by [L3th4l] - 21.11.2010, 17:40
Re: Please help me ! - by Tekto - 21.11.2010, 17:42
Re: Please help me ! - by NewbBeginner - 21.11.2010, 17:44
Re: Please help me ! - by TheNuttyScientist - 21.11.2010, 17:44
Re: Please help me ! - by NewbBeginner - 21.11.2010, 17:46
Re: Please help me ! - by [L3th4l] - 21.11.2010, 18:25

Forum Jump:


Users browsing this thread: 1 Guest(s)