Raised This Month: $32 Target: $400
 8% 

error 22: Maximum number of parameters reached


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
InstantDeath
Senior Member
Join Date: Mar 2007
Old 01-29-2010 , 01:55   error 22: Maximum number of parameters reached
Reply With Quote #1

Code:
L 01/29/2010 - 00:35:10: [SM] Plugin encountered error 22: Maximum number of parameters reached
L 01/29/2010 - 00:35:10: [SM] Native "PrintHintText" reported: Translation string formatted incorrectly - missing at least 1 parameters
L 01/29/2010 - 00:35:10: [SM] Displaying call stack trace for plugin "crpg.smx":
L 01/29/2010 - 00:35:10: [SM]   [0]  Line 3125, D:\Steam\SteamApps\jasace5\counter-strike source\cstrike\addons\sourcemod\scripting\crpg.sp::QuestMenu()
As the above error message and the title states, I used too many parameters in a translation string. My problem is I cannot find the maximum number I can have. I have a lot of parameters I'd like to display, but if it is simply not possible, then I'll have to try something else.

So, Who knows what the maximum number of parameters i can have in a translation string, or just a string?

I'm trying to use this code(obviously it doesn't work, it causes repeated server crashes)

Code:
if (action == MenuAction_Select)
    {
        if(param2 == 0)
        {
            new team = GetClientTeam(param1);
            if(team == TEAM_CT)
                PrintHintText(param1, "%T", "Q1Dc", QuestObjective[param1][0]);
            else
                PrintHintText(param1, "%T", "Q1Dt", QuestObjective[param1][0]);
        }
        else if(param2 == 1)
        {
            new team = GetClientTeam(param1);
            if(team == TEAM_CT)
                PrintHintText(param1, "%T", "Q2Dc", QuestObjective[param1][1]);
            else
                PrintHintText(param1, "%T", "Q2Dt", QuestObjective[param1][1]);
        }
        else if(param2 == 2)
            PrintHintText(param1, "%T", "Q3D", QuestObjective[param1][2]);
        else if(param2 == 3)
            PrintHintText(param1, "%T", "Q4D", QuestObjective[param1][3]);
        else if(param2 == 4)
            PrintHintText(param1, "%T", "Q5D", QuestObjective[param1][4]);
        else if(param2 == 5)
            PrintHintText(param1, "%T", "Q6D", QuestObjective[param1][5]);
        else if(param2 == 6)
            PrintHintText(param1, "%T", "Q7D", QuestObjective[param1][6]);
        else if(param2 == 7)
            PrintHintText(param1, "%T", "Q8D", QuestObjective[param1][7]);
        
        else if(param2 == 8)
            PrintHintText(param1, "%T", "Q9D", WeaponKills[param1][0], WeaponKills[param1][1], WeaponKills[param1][3], WeaponKills[param1][4], WeaponKills[param1][5], WeaponKills[param1][6], WeaponKills[param1][8],
            WeaponKills[param1][9], WeaponKills[param1][10], WeaponKills[param1][11], WeaponKills[param1][12], WeaponKills[param1][13], WeaponKills[param1][14], WeaponKills[param1][15], WeaponKills[param1][16], WeaponKills[param1][17],
            WeaponKills[param1][18], WeaponKills[param1][19], WeaponKills[param1][20], WeaponKills[param1][21], WeaponKills[param1][22], WeaponKills[param1][24], WeaponKills[param1][25], WeaponKills[param1][26], WeaponKills[param1][27]);
        else if(param2 == 9)
            PrintHintText(param1, "%T", "Q10D", WeaponKills[param1][1], WeaponHeadshots[param1][1], WeaponKills[param1][2], WeaponHeadshots[param1][2], WeaponKills[param1][3], WeaponHeadshots[param1][3], WeaponKills[param1][4],
            WeaponHeadshots[param1][4], WeaponKills[param1][5], WeaponHeadshots[param1][5], WeaponKills[param1][6], WeaponHeadshots[param1][6], WeaponKills[param1][8], WeaponHeadshots[param1][8], WeaponKills[param1][9], WeaponHeadshots[param1][9], WeaponKills[param1][10],
            WeaponHeadshots[param1][10], WeaponKills[param1][11], WeaponKills[param1][12], WeaponKills[param1][13], WeaponHeadshots[param1][13], WeaponKills[param1][14], WeaponHeadshots[param1][14], WeaponKills[param1][15],
            WeaponHeadshots[param1][15], WeaponKills[param1][16], WeaponHeadshots[param1][16], WeaponKills[param1][17], WeaponHeadshots[param1][17], WeaponKills[param1][18], WeaponHeadshots[param1][18], WeaponKills[param1][19],    WeaponHeadshots[param1][19], WeaponKills[param1][20], 
            WeaponHeadshots[param1][20], WeaponKills[param1][21], WeaponHeadshots[param1][21], WeaponKills[param1][22], WeaponHeadshots[param1][22], WeaponKills[param1][23], WeaponHeadshots[param1][23], WeaponKills[param1][24], WeaponHeadshots[param1][24], WeaponKills[param1][25], 
            WeaponKills[param1][25]);
            
    }
oh, and if you needed it, the translation strings:

Code:
    "Q1Dc"
    {
        "#format"    "{1:d}"
        "en"        "{1}/1 Defusals\nYou or your teammates must defuse the bomb if it is planted.\nExperience Gained: 200"
    }

    "Q1Dt"
    {
        "#format"    "{1:d}"
        "en"        "{1}/1 Bombed Target\nYou or your teammates must bomb a target"
    }

    "Q2Dc"
    {
        "#format"    "{1:d}"
        "en"        "{1}/3 Hostages Rescued\nYou or your teammates must rescue at least 3 hostages\nExperience Gained: 300\nBonus Experience Gained: 100 each hostage you rescued."
    }
    
    "Q2Dt"
    {
        "#format"    "{1:d}"
        "en"        "{1}/3 Hostage Escape Failures\nYou or your teammates must prevent the Counter-Terrorists from rescuing the hostages.\nBonus Experience Gained: 100 each hostage stopped."
    }

    "Q3D"
    {
        "#format"    "{1:d}"
        "en"        "{1}/10 Kills\nYou must kill 10 enemies.\nExperience Gained: 200"
    }

    "Q4D"
    {
        "#format"    "{1:d}"
        "en"        "{1}/20 Kills\nYou must kill 20 enemies.\nExperience Gained: 4000"
    }

    "Q5D"
    {
        "#format"    "{1:d}"
        "en"        "{1}/40 Kills\nYou must kill 40 enemies.\nExperience Gained: 60000"
    }

    "Q6D"
    {
        "#format"    "{1:d}"
        "en"        "{1}/60 Kills\nYou must kill 60 enemies.\nExperience Gained: 800000"
    }

    "Q7D"
    {
        "#format"    "{1:d}"
        "en"        "{1}/80 Kills\nYou must kill 80 enemies.\nExperience Gained: 1000000"
    }

    "Q8D"
    {
        "#format"    "{1:d}"
        "en"        "{1}/100 Kills\nYou must kill 100 enemies.\nExperience Gained: 20000000"
    }

    "Q9D"
    {
        "#format"    "{1:d},{2:d},{3:d},{4:d},{5:d},{6:d},{7:d},{8:d},{9:d},{10:d},{11:d},{12:d},{13:d},{14:d},{15:d},{16:d},{17:d},{18:d},{19:d},{20:d},{21:d},{22:d},{23:d},{24:d},{25:d}"
        "en"        "{1}/50 AK-47 {2}/50 Aug {3}/50 Awp {4}/50 Deagle\n{5}/50 Elites {6}/50 Famas {7}/50 FiveSeven {8}/50 G3SG1\n{9}/50 Galil {10}/50 Glock {11}/50 HEgrenade {12}/50 knife\n{13}/50 M249 {14}/50 M3 {15}/50 M4A1 {16}/50 Mac10\n{17}/50 MP5Navy {18}/50 P228 {19}/50 P90 {20}/50 Scout\n{21}/50 SG550 {22}/50 SG552 {23}/50 UMP45 TMP\n{24}/50 USP {25}/50 XM1014\n Kill 50 Enemies with each weapon.\n Experience Gained: 200000000\n Unlocks: GunGame Skill"
    }

    "Q10D"
    {
        "#format"    "{1:d},{2:d},{3:d},{4:d},{5:d},{6:d},{7:d},{8:d},{9:d},{10:d},{11:d},{12:d},{13:d},{14:d},{15:d},{16:d},{17:d},{18:d},{19:d},{20:d},{21:d},{22:d},{23:d},{24:d},{25:d},{26:d},{27:d},{28:d},{29:d},{30:d},{31:d},{32:d},{33:d},{34:d},{35:d},{36:d},{37:d},{38:d},{39:d},{40:d},{41:d},{42:d},{43:d},{44:d},{45:d},{46:d},{47:d},{48:d},{49:d},{50:d}"
        "en"        "{1}/50 {2}/25 AK-47 {3}/50 {4}/25 Aug {5}/50 {6}/25 Awp {7}/50 {8}/25 Deagle\n{9}/50 {10}/25 Elites {11}/50 {12}/25 Famas {13}/50 {14}/25 FiveSeven {15}/50 {16}/25 G3SG1\n{17}/50 {18}/25 Galil {19}/50 {20}/25 Glock {21}/50 HEgrenade {22}/50 knife\n{23}/50 {24}/25 M249 {24}/50 {25}/25 M3 {26}/50 {27}/25 M4A1 {28}/50 {29}/25 Mac10\n{30}/50 {31}/25 MP5Navy {32}/50 {33}/25 P228 {34}/50 {35}/25 P90 {36}/50 {37}/25 Scout\n{38}/50 {39}/25 SG550 {40}/50 {41}/25 SG552 {42}/50 {43}/25 UMP45 TMP\n{44}/50 {45}/25 USP {46}/50 XM1014\n Kill 50 Enemies with each weapon, 23 of them must be headshots.\n Experience Gained: 200000000\n Unlocks: CopyCat Skill"
    }
__________________

Last edited by InstantDeath; 01-29-2010 at 02:02.
InstantDeath is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 01-29-2010 , 02:10   Re: error 22: Maximum number of parameters reached
Reply With Quote #2

Are you sure you have the right number of parameters in Q10D in the code? I counted 45, quickly. Which even if I am mistaken, I don't think I would be off by 5. Maybe double check that.
__________________
Greyscale is offline
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 01-29-2010 , 08:39   Re: error 22: Maximum number of parameters reached
Reply With Quote #3

I don't think you can pass more than 32 parameters to a function.
Fyren is offline
InstantDeath
Senior Member
Join Date: Mar 2007
Old 01-29-2010 , 13:16   Re: error 22: Maximum number of parameters reached
Reply With Quote #4

Quote:
Originally Posted by Fyren View Post
I don't think you can pass more than 32 parameters to a function.
If thats true, then I'll have to "paginate" my PrintHintText.
__________________
InstantDeath is offline
Sammy-ROCK!
Senior Member
Join Date: Jun 2008
Location: Near Mrs.Lag
Old 01-29-2010 , 13:34   Re: error 22: Maximum number of parameters reached
Reply With Quote #5

Or you can format a string?
Sammy-ROCK! is offline
InstantDeath
Senior Member
Join Date: Mar 2007
Old 01-29-2010 , 18:14   Re: error 22: Maximum number of parameters reached
Reply With Quote #6

I tried that. for some reason it keeps telling me the same error...
__________________
InstantDeath is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 01-29-2010 , 18:23   Re: error 22: Maximum number of parameters reached
Reply With Quote #7

Code:
     7      WeaponKills[param1][1],     WeaponHeadshots[param1][1], WeaponKills[param1][2], WeaponHeadshots[param1][2], WeaponKills[param1][3], WeaponHeadshots[param1][3], WeaponKills[param1][4],
     10     WeaponHeadshots[param1][4], WeaponKills[param1][5], WeaponHeadshots[param1][5], WeaponKills[param1][6], WeaponHeadshots[param1][6], WeaponKills[param1][8], WeaponHeadshots[param1][8], WeaponKills[param1][9], WeaponHeadshots[param1][9], WeaponKills[param1][10],
    8       WeaponHeadshots[param1][10], WeaponKills[param1][11], WeaponKills[param1][12], WeaponKills[param1][13], WeaponHeadshots[param1][13], WeaponKills[param1][14], WeaponHeadshots[param1][14], WeaponKills[param1][15],
  10        WeaponHeadshots[param1][15], WeaponKills[param1][16], WeaponHeadshots[param1][16], WeaponKills[param1][17], WeaponHeadshots[param1][17], WeaponKills[param1][18], WeaponHeadshots[param1][18], WeaponKills[param1][19],    WeaponHeadshots[param1][19], WeaponKills[param1][20], 
    10      WeaponHeadshots[param1][20], WeaponKills[param1][21], WeaponHeadshots[param1][21], WeaponKills[param1][22], WeaponHeadshots[param1][22], WeaponKills[param1][23], WeaponHeadshots[param1][23], WeaponKills[param1][24], WeaponHeadshots[param1][24], WeaponKills[param1][25], 
     1      WeaponKills[param1][25]);

41. You can't pass 41 parameters to a phrase requiring 50.

32 might be the limit but all you gotta do is break the phrase into 2 chunks.
__________________
Greyscale is offline
BAILOPAN
Join Date: Jan 2004
Old 01-29-2010 , 21:23   Re: error 22: Maximum number of parameters reached
Reply With Quote #8

I think there is something wrong if you're pushing 50 parameters through a translation string. But yes, we have a 32 limit. You will want to break it up into a smaller workload. Most of the gunk in those strings is not language-dependent.
__________________
egg
BAILOPAN is offline
Kevin_b_er
SourceMod Donor
Join Date: Feb 2009
Old 01-29-2010 , 23:01   Re: error 22: Maximum number of parameters reached
Reply With Quote #9

Limit of 32 appears to only apply to translations, not to the limits in a simple string format specifier.
Kevin_b_er is offline
Frus
Senior Member
Join Date: Aug 2009
Old 01-31-2010 , 11:22   Re: error 22: Maximum number of parameters reached
Reply With Quote #10

When using %T don't you need to specify the client/server to use the language from? I thought you usually use %t for things like printhinttext.
Frus 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 23:54.


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