SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 19/05/2017, 05:30 PM   #11
fireranger11
Big Clucker
 
Join Date: Dec 2016
Location: Paksitan
Posts: 99
Reputation: 14
Default Re: Help +rep

Quote:
if(dialogid == BANK_MENU_2) // WARNING
{
if(response)
{
new username[24];
if(sscanf(inputtext, "s[24]", username))
{
ShowPlayerDialog(playerid, BANK_MENU_2, DIALOG_STYLE_INPUT, ""RED"Bank - Transfer Funds", ""STEELBLUE"Please enter the exact username of the player to whom you would like to transfer funds:", "Proceed", "Cancel");
SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"Please enter a valid USERNAME");
return 1;
}
if(strcmp(GetName(playerid), username, true) == 0)
{
ShowPlayerDialog(playerid, BANK_MENU_2, DIALOG_STYLE_INPUT, ""RED"Bank - Transfer Funds", ""STEELBLUE"Please enter the exact username of the player to whom you would like to transfer funds:", "Proceed", "Cancel");
SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"You cannot transfer funds to your own account!");
return 1;
}
format(Bank_Transfer_To[playerid], 24, "%s", username);
mysql_format(MySQL, gQuery, 256, "SELECT * FROM `"Banks_Table"` WHERE `Holder` = '%e'", username);
mysql_tquery(MySQL, gQuery, "Safe_IsBankHolder", "i", playerid);
/*format(str, sizeof str, ""STEELBLUE"You're now transferring funds to "RED"%s"STEELBLUE". Please enter a amount to transfer:", username);
ShowPlayerDialog(playerid, BANK_MENU_2_1, DIALOG_STYLE_INPUT, ""RED"Bank - Transfer Funds", str, "Transfer", "Cancel");*/
}
}
if(dialogid == BANK_MENU_2_1)
{
if(response)
{
new money, str[256];
if((sscanf(inputtext, "i", money)))
{
format(str, sizeof str, ""STEELBLUE"You're now transferring funds to "RED"%s"STEELBLUE". Please enter a amount to transfer:", Bank_Transfer_To[playerid]);
ShowPlayerDialog(playerid, BANK_MENU_2_1, DIALOG_STYLE_INPUT, ""RED"Bank - Transfer Funds", str, "Transfer", "Cancel");
SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"Please enter a valid amount!");
return 1;
}
if(Bank_Balance[playerid] < money)
{
format(str, sizeof str, ""STEELBLUE"You're now transferring funds to "RED"%s"STEELBLUE". Please enter a amount to transfer:", Bank_Transfer_To[playerid]);
ShowPlayerDialog(playerid, BANK_MENU_2_1, DIALOG_STYLE_INPUT, ""RED"Bank - Transfer Funds", str, "Transfer", "Cancel");
SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"You don't have enough money!");
return 1;
}
if(IsPlayerConnected(GetPlayerID(Bank_Transfer_To[playerid])))
{
format(Bank_Transfer_From[(GetPlayerID(Bank_Transfer_To[playerid]))], 24, "%s", GetName(playerid));
format(str, sizeof str, ""RED"Bank of SFS "WHITE"- "PREMIUM"Your bank account has been credited with "RED"$%i "PREMIUM"by "RED"%s", money, GetName(playerid));
SendClientMessage(GetPlayerID(Bank_Transfer_To[playerid]), -1, str);
Bank_Balance[GetPlayerID(Bank_Transfer_To[playerid])] += money;
}
else
{
mysql_format(MySQL, str, sizeof str, "UPDATE "Banks_Table" SET Balance = Balance + '%i' WHERE Holder = '%e'", money, Bank_Transfer_To[playerid]);
mysql_tquery(MySQL, str, "", "");
}
format(str, sizeof str, ""RED"Bank of SFS "WHITE"- "PREMIUM"You have successfully transferred "RED"$%i "PREMIUM"to "RED"%s"PREMIUM".", money, Bank_Transfer_To[playerid]);
SendClientMessage(playerid, -1, str);
Bank_Balance[playerid] -= money;
format(IQuery, 256, "4[Bank of SFS] 1 - 14%s(%i) transferred 4$%i 14to %s!", GetName(playerid), playerid, money, Bank_Transfer_To[playerid]);
IRC_GroupSay(gGroupAdminID, IRC_Admin, IQuery);
}
}
if(dialogid == BANK_MENU_3) // INTEND WARNING
{
if(response)
{
new money, str[256];
if(sscanf(inputtext, "i", money))
{
ShowPlayerDialog(playerid, BANK_MENU_3, DIALOG_STYLE_INPUT, ""RED"Bank - Deposit Money", ""STEELBLUE"Please enter the money you want to deposit into your bank account:", "Deposit", "Cancel");
SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"Please enter a valid amount!");
return 1;
}
if(GetPlayerMoney(playerid) < money)
{
SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"You don't have enough money to deposit!");
return 1;
}
if(money <= 0)
{
ShowPlayerDialog(playerid, BANK_MENU_3, DIALOG_STYLE_INPUT, ""RED"Bank - Deposit Money", ""STEELBLUE"Please enter the money you want to deposit into your bank account:", "Deposit", "Cancel");
SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"Please enter a valid amount!");
return 1;
}
Bank_Balance[playerid] += money;
mysql_format(MySQL, str, sizeof str, "UPDATE `"Banks_Table"` SET `Balance` = Balance + '%i' WHERE `Holder` = '%e'", money, GetName(playerid));
mysql_tquery(MySQL, str, "", "");
format(str, sizeof str, ""RED"Bank of SFS "WHITE"- "PREMIUM"You have successfully deposited "RED"$%i "PREMIUM"in your bank account! "STEELBLUE"[Balance: $%i]", money, Bank_Balance[playerid]);
SendClientMessage(playerid, -1, str);
format(IQuery, 128, "4[Bank of SFS] 1- 14%s(%i) has deposited 4$%i!", GetName(playerid), playerid, money);
IRC_GroupSay(gGroupAdminID, IRC_Admin, IQuery);
GivePlayerMoney(playerid, -money);
}
}
What to do?:C
fireranger11 is offline   Reply With Quote
Old 19/05/2017, 05:36 PM   #12
Aly
Huge Clucker
 
Join Date: Oct 2012
Posts: 228
Reputation: 11
Default Re: Help +rep

Try something like this:

Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) 
{
	if(dialogid == BANK_MENU_2)
	{
		if(response)
		{
			new username[24];
			if(sscanf(inputtext, "s[24]", username))
			{
				ShowPlayerDialog(playerid, BANK_MENU_2, DIALOG_STYLE_INPUT, ""RED"Bank - Transfer Funds", ""STEELBLUE"Please enter the exact username of the player to whom you would like to transfer funds:", "Proceed", "Cancel");
				SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"Please enter a valid USERNAME");
				return 1;
			}
			if(strcmp(GetName(playerid), username, true) == 0)
			{
				ShowPlayerDialog(playerid, BANK_MENU_2, DIALOG_STYLE_INPUT, ""RED"Bank - Transfer Funds", ""STEELBLUE"Please enter the exact username of the player to whom you would like to transfer funds:", "Proceed", "Cancel");
				SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"You cannot transfer funds to your own account!");
				return 1;
			}
			format(Bank_Transfer_To[playerid], 24, "%s", username);
			mysql_format(MySQL, gQuery, 256, "SELECT * FROM `"Banks_Table"` WHERE `Holder` = '%e'", username);
			mysql_tquery(MySQL, gQuery, "Safe_IsBankHolder", "i", playerid);
			/*format(str, sizeof str, ""STEELBLUE"You're now transferring funds to "RED"%s"STEELBLUE". Please enter a amount to transfer:", username);
			ShowPlayerDialog(playerid, BANK_MENU_2_1, DIALOG_STYLE_INPUT, ""RED"Bank - Transfer Funds", str, "Transfer", "Cancel");*/
		}
	}
	if(dialogid == BANK_MENU_2_1)
	{
		if(response)
		{
			new money, str[256];
			if((sscanf(inputtext, "i", money)))
			{
				format(str, sizeof str, ""STEELBLUE"You're now transferring funds to "RED"%s"STEELBLUE". Please enter a amount to transfer:", Bank_Transfer_To[playerid]);
				ShowPlayerDialog(playerid, BANK_MENU_2_1, DIALOG_STYLE_INPUT, ""RED"Bank - Transfer Funds", str, "Transfer", "Cancel");
				SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"Please enter a valid amount!");
				return 1;
			}
			if(Bank_Balance[playerid] < money)
			{
				format(str, sizeof str, ""STEELBLUE"You're now transferring funds to "RED"%s"STEELBLUE". Please enter a amount to transfer:", Bank_Transfer_To[playerid]);
				ShowPlayerDialog(playerid, BANK_MENU_2_1, DIALOG_STYLE_INPUT, ""RED"Bank - Transfer Funds", str, "Transfer", "Cancel");
				SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"You don't have enough money!");
				return 1;
			}
			if(IsPlayerConnected(GetPlayerID(Bank_Transfer_To[playerid])))
			{
				format(Bank_Transfer_From[(GetPlayerID(Bank_Transfer_To[playerid]))], 24, "%s", GetName(playerid));
				format(str, sizeof str, ""RED"Bank of SFS "WHITE"- "PREMIUM"Your bank account has been credited with "RED"$%i "PREMIUM"by "RED"%s", money, GetName(playerid));
				SendClientMessage(GetPlayerID(Bank_Transfer_To[playerid]), -1, str);
				Bank_Balance[GetPlayerID(Bank_Transfer_To[playerid])] += money;
			}
			else
			{
				mysql_format(MySQL, str, sizeof str, "UPDATE "Banks_Table" SET Balance = Balance + '%i' WHERE Holder = '%e'", money, Bank_Transfer_To[playerid]);
				mysql_tquery(MySQL, str, "", "");
			}
			format(str, sizeof str, ""RED"Bank of SFS "WHITE"- "PREMIUM"You have successfully transferred "RED"$%i "PREMIUM"to "RED"%s"PREMIUM".", money, Bank_Transfer_To[playerid]);
			SendClientMessage(playerid, -1, str);
			Bank_Balance[playerid] -= money;
			format(IQuery, 256, "4[Bank of SFS] 1 - 14%s(%i) transferred 4$%i 14to %s!", GetName(playerid), playerid, money, Bank_Transfer_To[playerid]);
			IRC_GroupSay(gGroupAdminID, IRC_Admin, IQuery);
		}
	}
	if(dialogid == BANK_MENU_3)
	{
		if(response)
		{
			new money, str[256];
			if(sscanf(inputtext, "i", money))
			{
				ShowPlayerDialog(playerid, BANK_MENU_3, DIALOG_STYLE_INPUT, ""RED"Bank - Deposit Money", ""STEELBLUE"Please enter the money you want to deposit into your bank account:", "Deposit", "Cancel");
				SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"Please enter a valid amount!");
				return 1;
			}
			if(GetPlayerMoney(playerid) < money)
			{
				SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"You don't have enough money to deposit!");
				return 1;
			}
			if(money <= 0)
			{
				ShowPlayerDialog(playerid, BANK_MENU_3, DIALOG_STYLE_INPUT, ""RED"Bank - Deposit Money", ""STEELBLUE"Please enter the money you want to deposit into your bank account:", "Deposit", "Cancel");
				SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"Please enter a valid amount!");
				return 1;
			}
			Bank_Balance[playerid] += money;
			mysql_format(MySQL, str, sizeof str, "UPDATE `"Banks_Table"` SET `Balance` = Balance + '%i' WHERE `Holder` = '%e'", money, GetName(playerid));
			mysql_tquery(MySQL, str, "", "");
			format(str, sizeof str, ""RED"Bank of SFS "WHITE"- "PREMIUM"You have successfully deposited "RED"$%i "PREMIUM"in your bank account! "STEELBLUE"[Balance: $%i]", money, Bank_Balance[playerid]);
			SendClientMessage(playerid, -1, str);
			format(IQuery, 128, "4[Bank of SFS] 1- 14%s(%i) has deposited 4$%i!", GetName(playerid), playerid, money);
			IRC_GroupSay(gGroupAdminID, IRC_Admin, IQuery);
			GivePlayerMoney(playerid, -money);
		}
	}
	
	return 1;
}
Aly is offline   Reply With Quote
Old 19/05/2017, 05:37 PM   #13
Antenastyle
Big Clucker
 
Join Date: Apr 2017
Posts: 99
Reputation: 4
Default Re: Help +rep

Quote:
Originally Posted by fireranger11 View Post
What to do?:C
It can be produced because of the preceding code, above

Code:
if(dialogid == BANK_MENU_2)
Antenastyle is offline   Reply With Quote
Old 19/05/2017, 05:41 PM   #14
fireranger11
Big Clucker
 
Join Date: Dec 2016
Location: Paksitan
Posts: 99
Reputation: 14
Default Re: Help

if(dialogid == BANK_MENU_3)
{
if(response)
{
new money, str[256];
if(sscanf(inputtext, "i", money))
{
ShowPlayerDialog(playerid, BANK_MENU_3, DIALOG_STYLE_INPUT, ""RED"Bank - Deposit Money", ""STEELBLUE"Please enter the money you want to deposit into your bank account:", "Deposit", "Cancel");
SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"Please enter a valid amount!");
return 1;
}
if(GetPlayerMoney(playerid) < money)
{
SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"You don't have enough money to deposit!");
return 1;
}
if(money <= 0)
{
ShowPlayerDialog(playerid, BANK_MENU_3, DIALOG_STYLE_INPUT, ""RED"Bank - Deposit Money", ""STEELBLUE"Please enter the money you want to deposit into your bank account:", "Deposit", "Cancel");
SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"Please enter a valid amount!");
return 1;
}
Bank_Balance[playerid] += money;
mysql_format(MySQL, str, sizeof str, "UPDATE `"Banks_Table"` SET `Balance` = Balance + '%i' WHERE `Holder` = '%e'", money, GetName(playerid));
mysql_tquery(MySQL, str, "", "");
format(str, sizeof str, ""RED"Bank of SFS "WHITE"- "PREMIUM"You have successfully deposited "RED"$%i "PREMIUM"in your bank account! "STEELBLUE"[Balance: $%i]", money, Bank_Balance[playerid]);
SendClientMessage(playerid, -1, str);
format(IQuery, 128, "4[Bank of SFS] 1- 14%s(%i) has deposited 4$%i!", GetName(playerid), playerid, money);
IRC_GroupSay(gGroupAdminID, IRC_Admin, IQuery);
GivePlayerMoney(playerid, -money);
}
}
if(dialogid == BANK_MENU_4) //WARNING
{
if(response)
{
new money, str[256];
if(sscanf(inputtext, "i", money))
{
ShowPlayerDialog(playerid, BANK_MENU_4, DIALOG_STYLE_INPUT, ""RED"Bank - Withdraw Money", ""STEELBLUE"Please enter the money you want to withdraw from your bank account:", "Withdraw", "Cancel");
SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"Please enter a valid amount to withdraw!");
return 1;
}
if(Bank_Balance[playerid] < money)
{
ShowPlayerDialog(playerid, BANK_MENU_4, DIALOG_STYLE_INPUT, ""RED"Bank - Withdraw Money", ""STEELBLUE"Please enter the money you want to withdraw from your bank account:", "Withdraw", "Cancel");
SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"You don't have enough money in your bank account!");
return 1;
}
if(money <= 0)
{
ShowPlayerDialog(playerid, BANK_MENU_4, DIALOG_STYLE_INPUT, ""RED"Bank - Withdraw Money", ""STEELBLUE"Please enter the money you want to withdraw from your bank account:", "Withdraw", "Cancel");
SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"Please enter a valid amount to withdraw!");
return 1;
}
Bank_Balance[playerid] -= money, GivePlayerMoney(playerid, money);
mysql_format(MySQL, str, sizeof str, "UPDATE `"Banks_Table"` SET `Balance` = Balance - '%i' WHERE `Holder` = '%e'", money, GetName(playerid));
mysql_tquery(MySQL, str, "", "");
format(str, sizeof str, ""RED"Bank of SFS "WHITE"- "PREMIUM"You have withdrawn "RED"$%i "PREMIUM"from your bank account! "STEELBLUE"[Balance: $%i]", money, Bank_Balance[playerid]);
SendClientMessage(playerid, -1, str);
format(IQuery, 256, "4[Bank of SFS] 1- 14%s(%i) has withdrawn 4%i!", GetName(playerid), playerid, money);
IRC_GroupSay(gGroupAdminID, IRC_Admin, IQuery);
}
}

now the warning is at Bank _menu_4 lmao
fireranger11 is offline   Reply With Quote
Old 19/05/2017, 05:43 PM   #15
Aly
Huge Clucker
 
Join Date: Oct 2012
Posts: 228
Reputation: 11
Default Re: Help

Just indent all the lines as in the code i and others have provided you.
Aly is offline   Reply With Quote
Old 19/05/2017, 05:43 PM   #16
fireranger11
Big Clucker
 
Join Date: Dec 2016
Location: Paksitan
Posts: 99
Reputation: 14
Default Re: Help

I had intended the whole ondialogresponse code with http://samp-indent.eu.pn/indent.php, still warnings on some places
fireranger11 is offline   Reply With Quote
Old 19/05/2017, 05:46 PM   #17
Aly
Huge Clucker
 
Join Date: Oct 2012
Posts: 228
Reputation: 11
Default Re: Help

Can you show us where the warnings appear after indenting it using that website?
Aly is offline   Reply With Quote
Old 19/05/2017, 05:48 PM   #18
Antenastyle
Big Clucker
 
Join Date: Apr 2017
Posts: 99
Reputation: 4
Default Re: Help

Quote:
Originally Posted by fireranger11 View Post
I had intended the whole ondialogresponse code with http://samp-indent.eu.pn/indent.php, still warnings on some places
Could you show us the full OnDialogResponse, because I'm trying to compile the full code and it doesn't have any loose indentation warning...
Antenastyle is offline   Reply With Quote
Old 19/05/2017, 05:50 PM   #19
fireranger11
Big Clucker
 
Join Date: Dec 2016
Location: Paksitan
Posts: 99
Reputation: 14
Default Re: Help

Aight its fixed now, Thanks everyone <3333 Repped Antenastyle and Aly
fireranger11 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 11:10 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.