AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   string error (https://forums.alliedmods.net/showthread.php?t=295360)

Adomaz1 03-23-2017 13:36

string error
 
I get this error:
Code:

String formatted incorrectly - parameter 11 (total 10)
L 03/23/2017 - 19:33:32: [AMXX] Displaying debug trace (plugin "statsx_shell.amxx", version "1.8.3-dev+5067")
L 03/23/2017 - 19:33:32: [AMXX] Run time error 25: parameter error
L 03/23/2017 - 19:33:32: [AMXX]    [0] statsx_shell.sma::cmdRank (line 1857)

My code:
Code:

public cmdRank(id)
{
        new izStats[8], izBody[8];
        new iRankPos, iRankMax, iRatio;
               
        iRankPos = get_user_stats(id, izStats, izBody)
        iRankMax = get_statsnum()
        iRatio = izStats[STATS_KILLS] - izStats[STATS_DEATHS]
       
        client_print_color(id, id, "%L", id, "YOUR_RANK_IS", iRankPos, iRankMax, izStats[STATS_KILLS], izStats[STATS_DEATHS], iRatio);
       
        return PLUGIN_CONTINUE
}

LANG line:
Code:

YOUR_RANK_IS = ^3* ^1You're ranked ^3%i ^1out of ^3%i players^1. You have ^3%i kill(s)^1, ^3%i death(s) ^1and your ratio is ^3%i^1.
what's the problem here?:?

MspoR 03-23-2017 14:07

Re: string error
 
Not defined izStats, izBody ?

EFFx 03-23-2017 14:53

Re: string error
 
There's nothing wrong with your code, just the information because the line 1857 has 5 parameters, not 11.

kristi 03-23-2017 15:12

Re: string error
 
@Adomaz1
Dont change the string formats.
should be:
Code:

YOUR_RANK_IS = ^3* ^1You're ranked ^3%i ^1out of ^3%d players^1. You have ^3%d kill(s)^1, ^3%0.2f death(s) ^1and your ratio is ^3%0.2f%%^1.

EFFx 03-23-2017 15:28

Re: string error
 
Yes, they're.

The problem isn't the string format, still with 4 parameters and the error says 11.

kristi 03-23-2017 15:31

Re: string error
 
Didn't see that sry.

Adomaz1 03-24-2017 15:34

Re: string error
 
Quote:

Originally Posted by EFFx (Post 2506069)
There's nothing wrong with your code, just the information because the line 1857 has 5 parameters, not 11.

now I'm confused, how can it be 11 parameters if only 5 are specified?

EFFx 03-24-2017 15:58

Re: string error
 
I'm too. Show the source code.

jimaway 03-24-2017 16:24

Re: string error
 
lang file might be forked and the plugin takes 2 lines as one

Adomaz1 04-02-2017 05:11

Re: string error
 
so I found out that everything works when I remove "iRatio", but that part is kinda important and I don't want to remove it :s

how should I do it? these ways don't work:
Code:

public cmdRank(id)
{
        new izStats[8], izBody[8];
        new iRankPos, iRankMax, iRatio, a, b;
               
        iRankPos = get_user_stats(id, izStats, izBody)
        iRankMax = get_statsnum()
        a = izStats[STATS_DEATHS]
        b = izStats[STATS_KILLS]
        iRatio = a-b
       
        client_print_color(id, id, "%L", id, "YOUR_RANK_IS", iRankPos, iRankMax, izStats[STATS_KILLS], izStats[STATS_DEATHS], iRatio);
       
        return PLUGIN_CONTINUE
}

Code:

public cmdRank(id)
{
        new izStats[8], izBody[8];
        new iRankPos, iRankMax;
               
        iRankPos = get_user_stats(id, izStats, izBody)
        iRankMax = get_statsnum()
       
        client_print_color(id, id, "%L", id, "YOUR_RANK_IS", iRankPos, iRankMax, izStats[STATS_KILLS], izStats[STATS_DEATHS], izStats[STATS_KILLS] - izStats[STATS_DEATHS]);
       
        return PLUGIN_CONTINUE
}

also tried to change the ML line's string to %0.2f and %d but it also didn't work.


All times are GMT -4. The time now is 18:00.

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