SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 19/05/2017, 03:29 PM   #1
fireranger11
Big Clucker
 
Join Date: Dec 2016
Location: Paksitan
Posts: 99
Reputation: 14
Default Help

Loose intend, i tried evry possible thing, still its appearing somewhere in here
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");
*/}
}
//error line 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);
}
}
fireranger11 is offline   Reply With Quote
Old 19/05/2017, 03:52 PM   #2
Antenastyle
Big Clucker
 
Join Date: Apr 2017
Posts: 95
Reputation: 4
Default Re: Help +rep

Use format [CODE] on forum, it makes the code to see the tabs.
Antenastyle is offline   Reply With Quote
Old 19/05/2017, 03:52 PM   #3
aoky
Huge Clucker
 
aoky's Avatar
 
Join Date: Oct 2016
Location: Kildare, Ireland
Posts: 311
Reputation: 16
Default Re: Help +rep

Your code is all set to one line, here try this:
PHP Code:
        Loose intendi tried evry possible thingstill its appearing somewhere in here
        
if(dialogid == BANK_MENU_2)
        {
        if(
response)
        {
        new 
username[24];
        if(
sscanf(inputtext"s[24]"username))
        {
        
ShowPlayerDialog(playeridBANK_MENU_2DIALOG_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), usernametrue) == 0)
        {
        
ShowPlayerDialog(playeridBANK_MENU_2DIALOG_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(MySQLgQuery256"SELECT * FROM `"Banks_Table"` WHERE `Holder` = '%e'"username);
        
mysql_tquery(MySQLgQuery"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");
        */
}
        }
        
//error line if(dialogid == BANK_MENU_2_1)
        
{
        if(
response)
        {
        new 
moneystr[256];
        if((
sscanf(inputtext"i"money)))
            {
        
format(strsizeof str""STEELBLUE"You're now transferring funds to "RED"%s"STEELBLUE". Please enter a amount to transfer:"Bank_Transfer_To[playerid]);
        
ShowPlayerDialog(playeridBANK_MENU_2_1DIALOG_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(strsizeof str""STEELBLUE"You're now transferring funds to "RED"%s"STEELBLUE". Please enter a amount to transfer:"Bank_Transfer_To[playerid]);
        
ShowPlayerDialog(playeridBANK_MENU_2_1DIALOG_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(strsizeof str""RED"Bank of SFS "WHITE"- "PREMIUM"Your bank account has been credited with "RED"$%i "PREMIUM"by "RED"%s"moneyGetName(playerid));
        
SendClientMessage(GetPlayerID(Bank_Transfer_To[playerid]), -1str);
        
Bank_Balance[GetPlayerID(Bank_Transfer_To[playerid])] += money;
        }
        else
        {
        
mysql_format(MySQLstrsizeof str"UPDATE "Banks_Table" SET Balance = Balance + '%i' WHERE Holder = '%e'"moneyBank_Transfer_To[playerid]);
        
mysql_tquery(MySQLstr"""");
        }
        
format(strsizeof str""RED"Bank of SFS "WHITE"- "PREMIUM"You have successfully transferred "RED"$%i "PREMIUM"to "RED"%s"PREMIUM"."moneyBank_Transfer_To[playerid]);
        
SendClientMessage(playerid, -1str);
        
Bank_Balance[playerid] -= money;
        
format(IQuery256"4[Bank of SFS] 1 - 14%s(%i) transferred 4$%i 14to %s!"GetName(playerid), playeridmoneyBank_Transfer_To[playerid]);
        
IRC_GroupSay(gGroupAdminIDIRC_AdminIQuery);
        }
        }
        
fireranger11 is online now  Add to fireranger11's Reputation  Report Post 
__________________
aoky is offline   Reply With Quote
Old 19/05/2017, 03:58 PM   #4
DobbysGamertag
Gangsta
 
DobbysGamertag's Avatar
 
Join Date: Jan 2013
Location: England
Posts: 925
Reputation: 99
Default Re: Help +rep

Quote:
Originally Posted by Antenastyle View Post
Use format [CODE] on forum, use this in the top of your script:

Code:
#pragma tabsize 0
Don't ever use this. It encourages bad practice. Any competent programmer can indent their code. Use TAB, or if you're really that bad, use spacebar (4 times, i believe).

@OP Use something like this if you're really struggling. Don't follow the above post.

Quote:
Banned Code - There is a certain "#pragma" that can be used to hide significant warnings and produce unreadable code - DO NOT advocate its use if you know what it is; it is TERRIBLE practice and we want to get rid of it.
source
DobbysGamertag is offline   Reply With Quote
Old 19/05/2017, 04:13 PM   #5
Antenastyle
Big Clucker
 
Join Date: Apr 2017
Posts: 95
Reputation: 4
Default Re: Help +rep

Quote:
Originally Posted by DobbysGamertag View Post
Don't ever use this. It encourages bad practice. Any competent programmer can indent their code. Use TAB, or if you're really that bad, use spacebar (4 times, i believe).

@OP Use something like this if you're really struggling. Don't follow the above post.


source
Yeah, I know that's bad, I don't, and won't use it...
Antenastyle is offline   Reply With Quote
Old 19/05/2017, 04:19 PM   #6
fireranger11
Big Clucker
 
Join Date: Dec 2016
Location: Paksitan
Posts: 99
Reputation: 14
Default Re: Help +rep

Now the intend is here
if(dialogid == BANK_MENU_2)
fireranger11 is offline   Reply With Quote
Old 19/05/2017, 04:21 PM   #7
Hansrutger
Gangsta
 
Hansrutger's Avatar
 
Join Date: May 2011
Location: Sweden
Posts: 901
Reputation: 135
Default Re: Help +rep

Quote:
Originally Posted by DobbysGamertag View Post
Don't ever use this. It encourages bad practice. Any competent programmer can indent their code. Use TAB, or if you're really that bad, use spacebar (4 times, i believe).

@OP Use something like this if you're really struggling. Don't follow the above post.


source
https://www.youtube.com/watch?v=SsoOG6ZeyUI

Just had to since you mentioned it :P
__________________



Current progression on roleplay gamemode:
Week 1 ( 22/04-30/04 ): 10524 loc
...
Week 15 ( 30/07-06/08 ): 72535 loc
Hansrutger is offline   Reply With Quote
Old 19/05/2017, 04:31 PM   #8
Antenastyle
Big Clucker
 
Join Date: Apr 2017
Posts: 95
Reputation: 4
Default Re: Help +rep

Try this

Code:
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);
	}
}
Antenastyle is offline   Reply With Quote
Old 19/05/2017, 04:48 PM   #9
fireranger11
Big Clucker
 
Join Date: Dec 2016
Location: Paksitan
Posts: 99
Reputation: 14
Default Re: Help +rep

Thats not working as well
fireranger11 is offline   Reply With Quote
Old 19/05/2017, 04:58 PM   #10
Antenastyle
Big Clucker
 
Join Date: Apr 2017
Posts: 95
Reputation: 4
Default Re: Help +rep

Quote:
Originally Posted by fireranger11 View Post
Thats not working as well
Error and line?
Antenastyle 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 05:47 PM.


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