[HELP]How to convert money into coins?
#1

I want to make something that is called coin using zcmd

When a player types /convert ... he must get a dialog box and then it must ask for " How many coins you need? " 1 coin = $1000 , if he types 1 then -$1000..

If he types /mycoins he must get the info how many coins he have !!!

And in the Script files / Users , I must get the info like pCoin x .. thanks

Last time I asked for 1 but it didn't worked this time I gave the clean explaination in which way I need help I want to use that coins in buying special weapons , donators ,etc
... Thanks
Reply
#2

You gotta try making it yourself, and we can help you with any problems arising.
Reply
#3

Dude i don't have my codes.. I need to make 2 more things i..e Goldnigets and diamonds , if you make me this coin codes I can make these two things by my own and learn that codes... Thanks
Reply
#4

I didn't test it, but here you go:
pawn Код:
#define isnull(%1) ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))

#define DIALOG_COINS 500

new pCoins[MAX_PLAYERS];

CMD:convert(playerid, params[]) return ShowCoinsDialog(playerid);

CMD:mycoins(playerid, params[])
{
    new string[144];
    format(string, sizeof(string), "You have %d coins!", pCoins[playerid]);
    SendClientMessage(playerid, -1, string);
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_COINS)
    {
        if(!response) return 1;
        else if(response)
        {
            if(isnull(inputtext) || !IsNumeric(inputtext)) return ShowCoinsDialog(playerid);
            else
            {
                new coins = strval(inputtext);
                if(GetPlayerMoney(playerid) < (1000 * coins)) return SendClientMessage(playerid, -1, "You don't have enough money.");

                pCoins[playerid] += coins;
                GivePlayerMoney(playerid, -(1000 * coins));
            }
        }
    }
    return 1;
}

stock ShowCoinsDialog(playerid) return ShowPlayerDialog(playerid, DIALOG_COINS, DIALOG_STYLE_INPUT, "{FF8000}Coins", "How much coins do you want?", "Submit", "Close");

stock IsNumeric(string[])
{
    for(new i = 0; i < strlen(string); i ++) if (string[i] > '9' || string[i] < '0') return false;
    return true;
}
I'm pretty sure you can add the rest, just try!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)