Raised This Month: $433 Target: $400
 108% 

why String formatted incorrectly


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Location: Derbent, Caucasian
Old 02-12-2020 , 14:21   why String formatted incorrectly
Reply With Quote #1

I repeatedly went over the line what I didn't do right it makes me a problem when I write a command for opening MENU

Quote:
L 02/12/2020 - 20:203: String formatted incorrectly - parameter 4 (total 3)
L 02/12/2020 - 20:203: [AMXX] Displaying debug trace (plugin "BanCT.amxx", version "v1.0")
L 02/12/2020 - 20:203: [AMXX] Run time error 25: parameter error
L 02/12/2020 - 20:203: [AMXX] [0] BanCT.sma::CmdBanCtMenu (line 276)
Code:
public CmdBanCtMenu( client )
{
	if ( !is_user_connected( client ) )
		return 1;
	
	if ( ! ( get_user_flags( client ) & BANCT_ACCESS ) )
	{
		client_print_color( client, client, "[System] ^1You have^x03 no access^x01 to this command.");
		
		return PLUGIN_HANDLED;
	}
	
	if ( ! ( get_user_flags( client ) == BANCT_ACCESS ) )
	{
		client_print_color( 0, client, "%s ^1ADMIN:^3 %s^1 has open^4 BanCT^1 Menu.", g_szPrefix, GetUserName( client ) );
	}
	
	static szMenu[ 50 ], iMenu, iCallback;
	
	formatex( szMenu, charsmax( szMenu ), "\r[%s] \wJailbreak \yBanCT \wMenu", g_szMenuPrefix );
	
	iMenu = menu_create( szMenu, "CmdBanCtMenu_Handler" );
	
	iCallback = menu_makecallback( "CmdBanCtMenu_Callback" );
	
	menu_additem( iMenu, "\wBan Player" );
	
	menu_additem( iMenu, "\wView List", _, _, iCallback );
	
	menu_display( client, iMenu, 0 );
	
	return 1;
}
__________________
Quote:
Learning Application Development /Pyhton/

Last edited by Fuck For Fun; 02-12-2020 at 14:22.
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 02-12-2020 , 19:56   Re: why String formatted incorrectly
Reply With Quote #2

Second parameter should be print_team_* (default, red, etc.)
__________________
Discord: wEight#6773

Hobbies:
- Map Designing (Any Half-Life 1 Engine Game)
- Pawn (Intermediate / Counter-Strike 1.6 only)
- C#/VB for .Net (Intermediate / Winforms)
- Java (Mostly Android Application Development)
redivcram is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Location: Derbent, Caucasian
Old 02-13-2020 , 10:50   Re: why String formatted incorrectly
Reply With Quote #3

Quote:
Originally Posted by redivcram View Post
Second parameter should be print_team_* (default, red, etc.)
Yes I did, but I didn't understand why I would didn't use CLIENT because I create COLOR for client ^ 3

i did something like that:
Code:
public CmdBanCtMenu( client )
{
	if ( !is_user_connected( client ) )
		return 1;
	
	if ( ! ( get_user_flags( client ) & BANCT_ACCESS ) )
	{
		client_print_color( client, print_team_red, "[System] ^1You have^x03 no access^x01 to this command.");
		
		return PLUGIN_HANDLED;
	}
	
	if ( ! ( get_user_flags( client ) == BANCT_ACCESS ) )
	{
		client_print_color(0, client, "%s ADMIN:^3 %s^1 has open^4 BanCT^1 Menu.", g_szPrefix, GetUserName( client ) );
		
		
		static szMenu[ 50 ], iMenu, iCallback;
		
		formatex( szMenu, charsmax( szMenu ), "\r[%s] \wJailbreak \yBanCT \wMenu", g_szMenuPrefix );
		
		iMenu = menu_create( szMenu, "CmdBanCtMenu_Handler" );
		
		iCallback = menu_makecallback( "CmdBanCtMenu_Callback" );
		
		menu_additem( iMenu, "\wBan Player" );
		
		menu_additem( iMenu, "\wView List", _, _, iCallback );
		
		menu_display( client, iMenu, 0 );
	}
	
	return 1;
}
__________________
Quote:
Learning Application Development /Pyhton/
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 02-13-2020 , 12:17   Re: why String formatted incorrectly
Reply With Quote #4

Quote:
Originally Posted by redivcram View Post
Second parameter should be print_team_* (default, red, etc.)
Nope...

Code:
Note

The team color is defined by the sender's index. Alternatively, a
specific team color can be enforced using the print_team_* constants in
amxconst.inc

Note

Usage examples:
client_print_color(id, print_team_red, "^4Green ^3Red ^1Default")
client_print_color(id, id2, "^4Green ^3id2's team color, ^1Default")
__________________

Last edited by iceeedr; 02-13-2020 at 12:17.
iceeedr is offline
Send a message via Skype™ to iceeedr
thEsp
Veteran Member
Join Date: Aug 2017
Old 02-13-2020 , 15:38   Re: why String formatted incorrectly
Reply With Quote #5

Off-topic addition: You may use "%n" format rule to get a client's nickname (1.9?), and also you can use "fmt" native instead of formatting a temporary string (1.9+).
__________________
As the days, and the weeks, and the months fly-by, really take time to appreciate the ones you love, before they die...

Last edited by thEsp; 02-13-2020 at 16:02. Reason: Typo
thEsp is offline
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

Forum Jump


All times are GMT -4. The time now is 05:53.


Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Theme made by Freecode