Raised This Month: $ Target: $400
 0% 

String formatted incorrectly - parameter 9 (total 8)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 05-31-2009 , 12:49   String formatted incorrectly - parameter 9 (total 8)
Reply With Quote #1

Hi , I have this errors and I don't understand what those errors mean :]
Quote:
L 05/31/2009 - 01:06:19: Start of error session.
L 05/31/2009 - 01:06:19: Info (map "cs_assault") (file "addons/amxmodx/logs/error_20090531.log")
L 05/31/2009 - 01:06:19: String formatted incorrectly - parameter 9 (total
L 05/31/2009 - 01:06:19: [AMXX] Displaying debug trace (plugin "gunxpmod_shop.amxx")
L 05/31/2009 - 01:06:19: [AMXX] Run time error 25: parameter error
L 05/31/2009 - 01:06:19: [AMXX] [0] gunxpmod_shop.sma::display_item_upgrades (line 11
L 05/31/2009 - 01:06:19: [AMXX] [1] gunxpmod_shop.sma::item_upgrades (line 59)
PHP Code:
#include <amxmodx>
#include <gunxpmod>

#define PLUGIN    "Gun Xp Mod Shop"
#define AUTHOR    "xbatista"
#define VERSION    "1.3"

#define MAX_UNLOCKS 25
#define MAX_UNLOCKS_NAME_SIZE 64
#define MAX_UNLOCKS_DESC_SIZE 128

new g_numberofitems
new g_menuPosition[33]
new 
bool:g_PlayerItem[33][MAX_UNLOCKS+1]
new 
g_itemindex[MAX_UNLOCKS+1]
new 
g_itemcost[MAX_UNLOCKS+1]
new 
g_itemname[MAX_UNLOCKS+1][MAX_UNLOCKS_NAME_SIZE+1]
new 
g_itemdesc[MAX_UNLOCKS+1][MAX_UNLOCKS_DESC_SIZE+1]


public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_dictionary("gunxpmod.txt");
    
    
register_clcmd("say /unlocks""item_upgrades")
    
register_clcmd("say unlocks""item_upgrades")
    
register_clcmd("say /ul""item_upgrades")
    
register_clcmd("say ul""item_upgrades")
    
register_clcmd("say /items""display_items")
    
register_clcmd("say items""display_items")

    
register_menucmd(register_menuid("Unlocks Shop"), 1023"action_item_upgrades")
}
public 
client_connect(id)
{
    for(new 
1<= MAX_UNLOCKS; ++i
    {
        
g_PlayerItem[id][i] = false
    
}
}
public 
display_items(id)
{
    new 
szMotd[2048], szTitle[64], iPos 0
    format
(szTitle63"Items List")
    
iPos += format(szMotd[iPos], 2047-iPos"<html><head><style type=^"text/css^">pre{color:#FFB000;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><pre><body>")
    
iPos += format(szMotd[iPos], 2047-iPos"^n^n<b>%s</b>^n^n"szTitle)
    
iPos += format(szMotd[iPos], 2047-iPos"# Item Name | Item Description | Item Cost^n")
    
    for(new 
1<= g_numberofitemsi++) 
    {
        
iPos += format(szMotd[iPos], 2047-iPos"%d. %s | %s | %d^n"ig_itemname[i], g_itemdesc[i], g_itemcost[i])
    }
    
show_motd(idszMotdszTitle)
    return 
PLUGIN_HANDLED;
}
public 
item_upgrades(id)
{
    
display_item_upgrades(idg_menuPosition[id] = 0);
    return 
PLUGIN_HANDLED;
}
public 
display_item_upgrades(idpos)
{    
    if(!
is_user_alive(id)) 
        return;

    static 
menuBody[510], len;
    
len 0

    
if(pos 0
    {
        return;
    }
    
    new 
start pos 8
    
if(start >= g_numberofitems
    {
        
start pos g_menuPosition[id]
    }

    
len += formatex(menuBody[len], sizeof menuBody len"%L"LANG_SERVER"TITLE_MENU_SHOP"get_user_xp(id), get_user_max_level(id))
    
    new 
end start 8
    
new keys MENU_KEY_0

    
if(end g_numberofitems
    {
        
end g_numberofitems
    
}
    
    new 
0
    
for(new startend; ++a
    {
        new 
1
        
new money

        money 
get_user_xp(id)

        if( 
money g_itemcost[i] ) 
        {
            if( 
g_PlayerItem[id][i] ) 
            {
                
len += formatex(menuBody[len], sizeof menuBody len,"%L"id"INACTIVE_MENU_SHOP_BOUGHT", ++bg_itemname[i], g_itemcost[i])
            }
            else
            {
                
len += formatex(menuBody[len], sizeof menuBody len,"%L"id"INACTIVE_MENU_SHOP", ++bg_itemname[i], g_itemcost[i])
            }
        } 
        else if( 
g_PlayerItem[id][i] ) 
        {
            
len += formatex(menuBody[len], sizeof menuBody len,"%L"id"INACTIVE_MENU_SHOP_BOUGHT", ++bg_itemname[i], g_itemcost[i])
        } 
        else 
        {
            
keys |= (1<<b)

            
len += formatex(menuBody[len], sizeof menuBody len,"%L"id"ACTIVE_MENU_SHOP", ++bg_itemname[i], g_itemcost[i])
        }
    }

    if(
end != g_numberofitems)
    {
        
len += formatex(menuBody[len], sizeof menuBody len"^n\r9. \w%L\r^n0. \w%L"id"NEXT_MENU"idpos "BACK_MENU" "EXIT_MENU")
        
keys |= MENU_KEY_9
    
}
    else
    {
        
len += formatex(menuBody[len], sizeof menuBody len"^n\r0. \w%L"idpos "BACK_MENU" "EXIT_MENU")
    }
    
    
show_menu(idkeysmenuBody, -1"Unlocks Shop")
}
public 
action_item_upgrades(idkey)
{
    switch(
key
    {
        case 
8display_item_upgrades(id, ++g_menuPosition[id]);
        case 
9display_item_upgrades(id, --g_menuPosition[id]);
        default:
        {
            if(!
is_user_alive(id)) 
            {
                return 
PLUGIN_HANDLED;
            }
            
            ++
key
            
new money
            
new plugin_id g_itemindex[g_menuPosition[id] * key]
            new 
item_id g_menuPosition[id] * key
            
new func get_func_id("gxm_item_enabled"plugin_id)

            
money get_user_xp(id)
            new 
cost g_itemcost[item_id]

            if(
money >= cost)
            {
                
callfunc_begin_i(funcplugin_id)
                
callfunc_push_int(id)
                
callfunc_end()

                
g_PlayerItem[id][item_id] = true

                
new overall money cost
                set_user_xp
(idoverall)

                
client_printcolor(id"/yItem Bought Successfully, Item: /g%s."g_itemname[item_id])
                
client_printcolor(id"/yDescription:/g%s."g_itemdesc[item_id])
                
display_item_upgrades(idg_menuPosition[id]);
            }
        }
    }
    return 
PLUGIN_HANDLED;
}

public 
register_item_gxm(item_indexitem_name[], item_desc[], item_cost)
{
    if(
g_numberofitems == MAX_UNLOCKS)
    {
        return -
2
    
}
    
    
g_numberofitems++
    
g_itemindex[g_numberofitems] = item_index
    format
(g_itemname[g_numberofitems], MAX_UNLOCKS_NAME_SIZEitem_name)
    
format(g_itemdesc[g_numberofitems], MAX_UNLOCKS_DESC_SIZEitem_desc)
    
g_itemcost[g_numberofitems] = item_cost
    
    
return g_numberofitems

xbatista is offline
Send a message via Skype™ to xbatista
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 05-31-2009 , 12:51   Re: String formatted incorrectly - parameter 9 (total 8)
Reply With Quote #2

PHP Code:
len += formatex(menuBody[len], sizeof menuBody len,"%L"id"ACTIVE_MENU_SHOP", ++bg_itemname[i], g_itemcost[i]) 
show us ACTIVE_MENU_SHOP from language file.
__________________
xPaw is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 05-31-2009 , 12:52   Re: String formatted incorrectly - parameter 9 (total 8)
Reply With Quote #3

Quote:
ACTIVE_MENU_SHOP = \r%d.\w %s - \y(Xp %d) - \yNot Bought^n
xbatista is offline
Send a message via Skype™ to xbatista
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 06-09-2009 , 06:56   Re: String formatted incorrectly - parameter 9 (total 8)
Reply With Quote #4

up
I must to solve this :}} someone help me? :]]
__________________
xbatista is offline
Send a message via Skype™ to xbatista
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 06-09-2009 , 07:00   Re: String formatted incorrectly - parameter 9 (total 8)
Reply With Quote #5

Just in some language missing %s or %d or smth else...
__________________
xPaw is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 06-09-2009 , 07:25   Re: String formatted incorrectly - parameter 9 (total 8)
Reply With Quote #6

Just remove all parameters from format and ACTIVE_MENU_SHOP. Then keep adding them one by one, each time checking if it works fine.

Maybe one of translations has too many formatting tags.
__________________
Impossible is Nothing
Sylwester is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 06-09-2009 , 07:45   Re: String formatted incorrectly - parameter 9 (total 8)
Reply With Quote #7

Sorry I really don't understand what you mean :/
Something like this :
PHP Code:
len += formatex(menuBody[len], sizeof menuBody len,"\r%d", ++b
Adding by one and check if there are errors?
__________________
xbatista is offline
Send a message via Skype™ to xbatista
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 06-09-2009 , 08:13   Re: String formatted incorrectly - parameter 9 (total 8)
Reply With Quote #8

I mean if you can't find error in a single line of code, then build that line from beginning, not all at once, but step by step and confirm at each step that it works and there are no errors. You should also do it without ML, and once it's finished convert it to ML.

It looks like you didn't read my second hint, so I will give you another one:
Code:
[ru]
ACTIVE_MENU_SHOP = \r%d.\w %s - \r%s \y(Opyt %i)^n
INACTIVE_MENU_SHOP = \d%d. %s - \r%s \d(\rNuzhnyj opyt %i\d)^n
Can you see any mistakes here?
__________________
Impossible is Nothing
Sylwester is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 06-09-2009 , 08:18   Re: String formatted incorrectly - parameter 9 (total 8)
Reply With Quote #9

But why you get russian language,it's not finished yet of translate?
And I'm using EN

Quote:
[ru]
ACTIVE_MENU_SHOP = \r%d.\w %s - \r%s \y(Opyt %i)^n
INACTIVE_MENU_SHOP = \d%d. %s - \r%s \d(\rNuzhnyj opyt %i\d)^n
I don't see mistake
__________________
xbatista is offline
Send a message via Skype™ to xbatista
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 06-09-2009 , 08:26   Re: String formatted incorrectly - parameter 9 (total 8)
Reply With Quote #10

Code:
[en]
ACTIVE_MENU_SHOP = \r%d.\w %s - \y(Xp %d) - \yNot Bought^n
[ru]
ACTIVE_MENU_SHOP = \r%d.\w %s - \r%s \y(Opyt %i)^n
How about now? 3 formatting tags in 1st and 4 formatting tags in 2nd, something like this may cause your problem. I took it from dictionary for your mod.
If the dictionary you are using now is different and has no such mistakes (make sure), then try to make this line from beginning like I told you in my previous posts.
__________________
Impossible is Nothing
Sylwester is offline
Reply



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 13:54.


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