[HELP]How to convert money into coins? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP]How to convert money into coins? (
/showthread.php?tid=567904)
[HELP]How to convert money into coins? -
fuckingcruse - 17.03.2015
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
Re: [HELP]How to convert money into coins? -
CalvinC - 17.03.2015
You gotta try making it yourself, and we can help you with any problems arising.
Re: [HELP]How to convert money into coins? -
fuckingcruse - 18.03.2015
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
Re: [HELP]How to convert money into coins? -
SickAttack - 18.03.2015
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!