How can i make /transfer dialog..
#8

Код:
if(strcmp(cmd, "/transfer", true) == 0 || strcmp(cmd, "/wiretransfer", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(PlayerInfo[playerid][pIsaBank] != 1)
	        {
	            SendClientMessage(playerid, COLOR_GREY, "   You are not at the Bank !");
	            return 1;
	        }
	        if(PlayerToPoint(1.0, playerid, 321.5792,129.2914,1007.9657))
	        {
	            SCM(playerid, COLOR_GREY, "   You are not in the right place !");
	            return 1;
			}
			new str[256];
			format(str,256,"%s\t"wh"Type the player "color_red"ID\t\n\n",str);
			ShowPlayerDialog(playerid,TransferDialog,DIALOG_STYLE_INPUT,""color_yellow"Bank:",str,"Ok","exit");
			return 1;
		}
		return 1;
 	}
ondialogresponse:
Код:
if(dialogid == TransferDialog)
	{
		if(response)
		{
		    if (IsPlayerConnected(playerid))
			{
		    	new giveplayerid = strval(inputtext);
				if (giveplayerid == playerid)
				{
				    format(string, 256, "%s"wh"You can't send money to yourself.\n\n",string);
					ShowPlayerDialog( playerid, 1559, DIALOG_STYLE_MSGBOX, ""color_yellow"Bank:", string, "Exit", "" );
					return 1;
				}
				else
				{
				    format(string, 256, "%s"wh"Type how much money do you want to transfer.\t\n",string);
				    format(string, 256, "%s"wh"Balance: "color_green"%d$"wh".\t\n\n",string, PlayerInfo[playerid][pAccount]);
					ShowPlayerDialog(playerid,TransferDialog+1,DIALOG_STYLE_INPUT,""color_yellow"Bank:", string,"Ok","Exit");
					PlayerInfo[playerid][pAccount] = giveplayerid;
				}
			}
		}
		return 1;
	}
	if(dialogid == TransferDialog+1)
	{
		if(response)
		{
		    new giveplayerid = PlayerInfo[playerid][pAccount];
			if (IsPlayerConnected(giveplayerid))
			{
			    if (giveplayerid == playerid)
				{
				    format(string, 256, "%s"wh"Type how much money do you want to transfer.\t\n",string);
				    format(string, 256, "%s"wh"Balance: "color_green"%d$"wh".\t\n\n",string, PlayerInfo[playerid][pAccount]);
					ShowPlayerDialog(playerid,TransferDialog+1,DIALOG_STYLE_INPUT,""color_yellow"Bank:", string,"Ok","Exit");
				}
				else
				{
					GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
					playermoney = PlayerInfo[playerid][pAccount];
					if (moneys > 0 && playermoney >= moneys)
					{
					    PlayerInfo[playerid][pAccount] = -moneys;
					    PlayerInfo[giveplayerid][pAccount] = moneys;
						format(string, sizeof(string), "%s"wh"You've send "color_green"%d$"wh" to "color_red"%s"wh".\t\n",string,moneys,giveplayer);
						ShowPlayerDialog( playerid, 1560, DIALOG_STYLE_MSGBOX, ""color_yellow"Bank:", string, "Exit", "" );
						PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
						format(string, sizeof(string), "** You have recieved $%d from %s(player: %d).", moneys, sendername, playerid);
						SendClientMessage(giveplayerid, COLOR_GRAD1, string);
						PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
					}
					else
					{
						format(string, 256, "%s"wh"Invalid tranzaction amount.\n",string);
						ShowPlayerDialog( playerid, 1551, DIALOG_STYLE_MSGBOX, ""color_yellow"Bank:", string, "Exit", "" );
						return 1;
					}
				}
			}
			else
			{
				format(string, 256, "%s"wh"This player isn't online.\n",string);
				ShowPlayerDialog( playerid, 1559, DIALOG_STYLE_MSGBOX, ""color_yellow"Bank:", string, "Exit", "" );
				return 1;
			}
		}
		return 1;
	}
But is bugged... if i type at the input id/name/something i lose money from Bank account... and if i type a id of a offline player when i get the dialog: "how much money blabla", i type 653453, i lose money too ( from bank account ) what is the problem ? :-s
Reply


Messages In This Thread
How can i make /transfer dialog.. - by qUick1337 - 06.09.2011, 23:19
Re: How can i make /transfer dialog.. - by =WoR=Varth - 06.09.2011, 23:22
Re: How can i make /transfer dialog.. - by qUick1337 - 06.09.2011, 23:29
Re: How can i make /transfer dialog.. - by dowster - 07.09.2011, 01:21
Re: How can i make /transfer dialog.. - by =WoR=G4M3Ov3r - 07.09.2011, 01:36
Re: How can i make /transfer dialog.. - by qUick1337 - 07.09.2011, 11:39
Re: How can i make /transfer dialog.. - by Sasino97 - 07.09.2011, 13:19
Re: How can i make /transfer dialog.. - by qUick1337 - 07.09.2011, 16:15
Re: How can i make /transfer dialog.. - by qUick1337 - 07.09.2011, 22:32
Re: How can i make /transfer dialog.. - by =WoR=Varth - 08.09.2011, 06:44

Forum Jump:


Users browsing this thread: 3 Guest(s)