/AcceptMoney command.
#1

What I am asking for if anyone could make a /acceptmoney command for me that will work with the /GiveMoney command below.

I have no idea how to do this myself so I beg for help.

I am having a problem with moneyhackers that are sending millions of money to my players.

pawn Код:
CMD:givemoney(playerid,params[]) {
    if(PlayerInfo[playerid][LoggedIn] == 1) {
    } else return SendClientMessage(playerid,red,"ERROR: You can't use this command!");
    new moneys,giveplayerid,giveplayer[MAX_PLAYER_NAME],sendername[MAX_PLAYER_NAME],playermoney[MAX_PLAYERS],string[128];
    if (sscanf(params, "ud",giveplayerid, moneys)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /givemoney [Playerid] [Amount]");
//  if (!IsNumeric(giveplayerid)) giveplayerid = ReturnPlayerID(giveplayerid);
    if (IsPlayerConnected(giveplayerid)) {
        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
        GetPlayerName(playerid, sendername, sizeof(sendername));
        playermoney[playerid] = GetPlayerMoney(playerid);
        if (moneys > 0 && playermoney[playerid] >= moneys) {
            GivePlayerMoney(playerid, (-moneys));
            GivePlayerMoney(giveplayerid, moneys);
            format(string, sizeof(string), "You have sent %s (id: %d), $%d.", giveplayer,giveplayerid, moneys);
            SendClientMessage(playerid, COLOR_GREEN, string);
            format(string, sizeof(string), "You have recieved $%d from %s (id: %d).", moneys, sendername, playerid);
            SendClientMessage(giveplayerid, COLOR_GREEN, string);
            printf("%s(playerid:%d) has transfered %d to %s(playerid:%d)",sendername, playerid, moneys, giveplayer, giveplayerid);
            format(string, sizeof(string),"%s (%d) has transfered [$%d] to %s (%d)",sendername, playerid, moneys, giveplayer, giveplayerid);
            SaveToFile("GiveMoney",string);
            MessageToAdmins(green,string);
        }
        else {
            SendClientMessage(playerid, COLOR_BRIGHTRED, "Invalid transaction amount.");
        }
    }
    else {
        format(string, sizeof(string), "ID:%d is not an active player.", giveplayerid);
        SendClientMessage(playerid, COLOR_BRIGHTRED, string);
    }
    return 1;
}
Reply
#2

something like this?

pawn Код:
new CanAcceptMoney[MAX_PLAYERS];
new MoneyAmount[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    CanAcceptMoney[playerid] = 0;
    MoneyAmount[playerid] = 0;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/givemoney") == 0)
    {
        new targetid = strval(GetToken(cmdtext, 1)); // your thing to get player id
        new money = strval(GetToken(cmdtext, 2)); // your thing to get amount of money
        if(IsPlayerConnected(targetid))
        {
            CanAcceptMoney[targetid] = 1;
            MoneyAmount[targetid] = money;
            SendClientMessage(targetid, -1, "Someone is sending you money! Type /acceptmoney to accept the money");
            return 1;
        }
    }
    if(strcmp(cmdtext, "/acceptmoney") == 0)
    {
        if(CanAcceptMoney[playerid] == 1)
        {
            GivePlayerMoney(playerid, MoneyAmoun[playerid]);
            CanAcceptMoney[playerid] = 0;
            return 1;
        }
    }
    return 0;
}
Reply
#3

Yes but could you make the command in zcmd?
Reply
#4

Quote:
Originally Posted by OleKristian95
Посмотреть сообщение
Yes but could you make the command in zcmd?
sorry I've never before used zcmd, only this what I showed you :X
Reply
#5

Ok thanks anyway, I'll try figure out how to do it myself
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)