Small help +rep fast
#1

Hi, I need a command that will make player receive ammount of money he types in the dialog.

Ex: /money
Dialog input shows and player types 500$ and they receive 500
Reply
#2

pawn Код:
#define DIALOG_MONEY 1
//Change the value after 'DIALOG_MONEY' to any dialog ID that is not currently in use

CMD:money(playerid, params[])
{
    ShowPlayerDialog(playerid, DIALOG_MONEY, DIALOG_STYLE_INPUT, "Money", "Enter the amount of money you want", "Confirm", "Cancel");
    return 1;
} //Command created with 'ZCMD'. https://sampforum.blast.hk/showthread.php?tid=91354

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_MONEY)
    {
        if(response)
        {
            new var = strval(inputtext);
            if((GetPlayerMoney(playerid) + var) > 99999999) return SendClientMessage(playerid, 0xFF0000FF, "You can't have that much money, you greedy pig.");
            //Not necessary, but it makes sense.
            GivePlayerMoney(playerid, var);
            SendClientMessage(playerid, 0xFFFF00FF, "Money Received.");
            return 1;
        }
    }
    return 0;
}
Sources:
https://sampwiki.blast.hk/wiki/OnDialogResponse
https://sampwiki.blast.hk/wiki/ShowPlayerDialog
https://sampwiki.blast.hk/wiki/Strval
https://sampwiki.blast.hk/wiki/GetPlayerMoney
https://sampwiki.blast.hk/wiki/GivePlayerMoney

Includes:
ZCMD - https://sampforum.blast.hk/showthread.php?tid=91354

Read up son.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)