Please help me !
#1

How can I do like if one player does /bounty ID AMOUNt, then this player is target, and anyone who kills him, gets this amount.
Reply
#2

Not going to fully make it, but get an idea from this:
pawn Код:
new pWanted[MAX_PLAYERS];
CMD:bounty(playerid, params[])
{
    new pID, Amount;
    if(sscanf(params, "ui", pID, Amount)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /Bounty < PlayerID > < Amount >");
    pWanted[pID] = Amount;
    return 1;
}

public OnPlayerDeath(....)
{
    if(pWanted[playerid] >= 0)
    {
        GivePlayerMoney(killerid, pWanted[playerid]);
        pWanted[playerid] = 0;
    }
    return 1;
}
Might not be the best, but give it a try
Reply
#3

I need it too.
Hmm, Can you explane more abit ?
Like,
Код:
pWanted[pID] = Amount;
Wanted player = Amount ? didnt get it
Reply
#4

Quote:
Originally Posted by [L3th4l]
Посмотреть сообщение
Not going to fully make it, but get an idea from this:
pawn Код:
new pWanted[MAX_PLAYERS];
CMD:bounty(playerid, params[])
{
    new pID, Amount;
    if(sscanf(params, "ui", pID, Amount)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /Bounty < PlayerID > < Amount >");
    pWanted[pID] = Amount;
    return 1;
}

public OnPlayerDeath(....)
{
    if(pWanted[playerid] >= 0)
    {
        GivePlayerMoney(killerid, pWanted[playerid]);
        pWanted[playerid] = 0;
    }
    return 1;
}
Might not be the best, but give it a try
Thanks it helped.
Reply
#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
#6

ZCMD Please ?
Reply
#7

Quote:
Originally Posted by Tekto
Посмотреть сообщение
I need it too.
Hmm, Can you explane more abit ?
Like,
Код:
pWanted[pID] = Amount;
Wanted player = Amount ? didnt get it
Sorry i suck at explaining stuff, but:

pWanted[pID] < The person that we are going to put a bounty on

Amount < amount of cash we are going to put on that player ^

---
So if a player dies, it will check if he has more than $0 of bounty, if yes, it will give that money to the killer

Meh, just a quick explanation
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)