Credits System
#1

I am trying to make a credits system where you do; /buycredits and then a box shows up saying; 1 credit = 5million dollars, 2 credits = 10million dollars and you pick one and then it takes that certain amount of money off you then a credit gets added to you and then a message to goes to all admins and they add that credit onto the website / Market place etc...

What i got so far;

Код:
#define DIALOG_STYLE_MSGBOX
Код:
CMD:buycredits(playerid, params[])
{
	new option, index, model, string[128];
	if(sscanf(params, "ii", option, index))
	{
	ShowPlayerDialog("");
	    return 1;
	}
Reply
#2

Can someone please help me
Reply
#3

ShowPlayerDialog
Dialog Styles
GetPlayerMoney
GivePlayerMoney
OnDialogResponse
Reply
#4

#1
use
Код:
enum
{
DIALOG_HOWEVER_YOU_CALL_IT,// DIALOG_HOWEVER_YOU_CALL_IT = 500, <- if u write it like this, it will count from 500 up to the limit
DIALOG_CREDIT1_CONFIRM
}
reason? It's like autoincrement.

#2
Код:
CMD:Buycredit..
{
//actually you dont need params here
#pragma unused params
ShowPlayerDialog(playerid,DIALOG_HOWEVER_YOU_CALL_IT,DIALOG_STYLE_LIST," Credits","1 Credit\n2 Credits\n..","Ok","Nope");
return 1;
}
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	switch(dialogid)
	{
		case DIALOG_HOWEVER_YOU_CALL_IT:
		{
			if(!response)return 1;
			switch(listitem)
				{
				case 0://1 credit
				{
					ShowPlayerDialog(playerid,DIALOG_CREDIT1_CONFIRM,DIALOG_STYLE_MSGBOX,"Credit #1","Buy 1 Credit for 1.000.000.","Confirm","Nope");
				}
				case 1://2 credit
				{
					//same ^
				}
			}
		}
		case DIALOG_CREDIT1_CONFIRM:
		{
		    if(!response)return SendClientMessage(playerid,-1," You disagreed");
			GivePlayerMoney(playerid,GetPlayerMoney(playerid) -100000);
			new i,string[60];
			format(string,sizeof(string)," %s bought 1 Credit.",NameStuff);
			for(i;<MAX_PLAYERS;i++)
			{
			    if(!IsPlayerConnected(i))continue;
			    if(!YourAdminStuff(i))continue;
				SendClientMessage(i,-1,string);
			}
		}
	}
	return 1;
}
Of course you will have to fix the code, so that it works for your system
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)