AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   why String formatted incorrectly (https://forums.alliedmods.net/showthread.php?t=321478)

Fuck For Fun 02-12-2020 14:21

why String formatted incorrectly
 
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:20:33: String formatted incorrectly - parameter 4 (total 3)
L 02/12/2020 - 20:20:33: [AMXX] Displaying debug trace (plugin "BanCT.amxx", version "v1.0")
L 02/12/2020 - 20:20:33: [AMXX] Run time error 25: parameter error
L 02/12/2020 - 20:20:33: [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;
}


redivcram 02-12-2020 19:56

Re: why String formatted incorrectly
 
Second parameter should be print_team_* (default, red, etc.)

Fuck For Fun 02-13-2020 10:50

Re: why String formatted incorrectly
 
Quote:

Originally Posted by redivcram (Post 2683577)
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;
}


iceeedr 02-13-2020 12:17

Re: why String formatted incorrectly
 
Quote:

Originally Posted by redivcram (Post 2683577)
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")


thEsp 02-13-2020 15:38

Re: why String formatted incorrectly
 
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+).


All times are GMT -4. The time now is 06:32.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.