/AcceptMoney command.
#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


Messages In This Thread
/AcceptMoney command. - by OleKristian95 - 30.07.2012, 18:23
Re: /AcceptMoney command. - by SEnergy - 30.07.2012, 18:29
Re: /AcceptMoney command. - by OleKristian95 - 30.07.2012, 18:41
Re: /AcceptMoney command. - by SEnergy - 30.07.2012, 18:43
Re: /AcceptMoney command. - by OleKristian95 - 30.07.2012, 19:14

Forum Jump:


Users browsing this thread: 1 Guest(s)