AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Problem with float.inc (https://forums.alliedmods.net/showthread.php?t=307560)

TheiOne 05-15-2018 07:46

Problem with float.inc
 
What does this error mean ?

Code:

L 05/15/2018 - 15:59:47: String formatted incorrectly - parameter 11 (total 10)
L 05/15/2018 - 15:59:47: [AMXX] Displaying debug trace (plugin "statsx_shell.amxx", version "1.8.3-dev+5154")
L 05/15/2018 - 15:59:47: [AMXX] Run time error 25: parameter error
L 05/15/2018 - 15:59:47: [AMXX]    [0] float.inc::operator/(Float:,_:) (line 294)
L 05/15/2018 - 15:59:47: [AMXX]    [1] statsx_shell.sma::effec (line 923)
L 05/15/2018 - 15:59:47: [AMXX]    [2] statsx_shell.sma::cmdRank (line 2774)

This is "effec" :

Code:

Float:effec(izStats[8])
{
        if (!izStats[STATS_KILLS])
                return (0.0) // line 923
       
        return (100.0 * float(izStats[STATS_KILLS]) / float(izStats[STATS_KILLS] + izStats[STATS_DEATHS]))
}

And cmdRank:

Code:

public cmdRank(id)
{
        if (!SayRank)
        {
                client_print_color(id, print_team_red, "^3%L", id, "DISABLED_MSG")
                return PLUGIN_HANDLED
        }

        new izStats[8], izBody[8]
        new iRankPos, iRankMax
               
        iRankPos = get_user_stats(id, izStats, izBody)
        iRankMax = get_statsnum()
       
        client_print_color(id, id, "^4* %L", id, "YOUR_RANK_IS", iRankPos, iRankMax, izStats[STATS_KILLS], izStats[STATS_HITS], ((effec(izStats) + accuracy(izStats)) / 2))
       
        return PLUGIN_CONTINUE
}

As shown in the error message above I'm using AMXX 1.8.3.

CrazY. 05-15-2018 10:25

Re: Problem with float.inc
 
Hm, maybe:

Code:
Float:effec(izStats[8]) {     if (!izStats[STATS_KILLS])         return _:0.0 // line 923         return (100.0 * float(izStats[STATS_KILLS]) / float(izStats[STATS_KILLS] + izStats[STATS_DEATHS])) }

or also:

Code:
Float:effec(izStats[8]) {     if (!izStats[STATS_KILLS])         return _:0.0 // line 923         new result = 100 * izStats[STATS_KILLS] / (izStats[STATS_KILLS] + izStats[STATS_DEATHS]);     return float(result); }

klippy 05-15-2018 12:40

Re: Problem with float.inc
 
The stack trace is wrong for whatever reason, but this is the real error:
Code:

L 05/15/2018 - 15:59:47: String formatted incorrectly - parameter 11 (total 10)
You are missing one argument in client_print_color.

TheiOne 05-16-2018 10:44

Re: Problem with float.inc
 
1 Attachment(s)
Thanks guys for the replies.

@CrazY.

I tried both ways, but still it shows the same error.

@KliPPy

I think you're right, but I can't figure out what's the missing parameter.
This is from the lang file:

Code:

YOUR_RANK_IS = Your rank is ^3%d ^4of ^3%d ^4with ^3%d kill(s)^4, ^3%d hit(s)^4, skill level  ^3%0.0f%%^4.
Of course I modified the colour tags to match with the client_print_color. Here I see that it has 4 integers, and one float, also in client_print_color 5 parameters are entered after "YOUR_RANK_IS" as in my 1st post, but I can't quite make out what is the purpose of "id" before "YOUR_RANK_IS" in client_print_color.

Only the * character before %L is printed in the game so maybe the problem lies in the "YOUR_RANK_IS".

Here's the original statsx_shell:

TheiOne 06-03-2018 17:47

Re: Problem with float.inc
 
bump

Natsheh 06-03-2018 18:06

Re: Problem with float.inc
 
Quote:

Originally Posted by TheiOne (Post 2592437)
Of course I modified the colour tags to match with the client_print_color. Here I see that it has 4 integers, and one float, also in client_print_color 5 parameters are entered after "YOUR_RANK_IS" as in my 1st post, but I can't quite make out what is the purpose of "id" before "YOUR_RANK_IS" in client_print_color.

https://wiki.alliedmods.net/Advanced...ingual_Support

Also make sure you are not dividing by zero.

fysiks 06-03-2018 18:12

Re: Problem with float.inc
 
Have you tried using the color encoding that is expected by the colorChat() function that you are using? I.e. it expects '$g', '$n', '$t'. (Just a shot in the dark on my part).

TheiOne 06-03-2018 20:55

Re: Problem with float.inc
 
@Natsheh

Thanks for the link on id.
How could I do that ? Like using an if() statement ?

@fysiks

I'm not using a colorChat() function. The original plugin is written for AMXX 1.8.2, and it had it's own colorChat() function, since I'm using AMXX 1.8.3 I completely removed that colorChat() function and replaced colorChat with client_print_color and also changed the parameters accordingly.

For example, this is from the original plugin:

Code:
colorChat(szPlayers[i], CHATCOLOR_GREEN, "%L", LANG_SERVER, "MM_TIME_PLAY_BONUS", iTime, iTmpCash)
Code:

MM_TIME_PLAY_BONUS = You are played $t%d h.$g in row and awarded $t%d$$g bonus
I've changed it to this which works:

Code:
client_print_color(szPlayers[i], print_team_default, "^4%L", LANG_SERVER, "MM_TIME_PLAY_BONUS", iTime, iTmpCash)
Code:

MM_TIME_PLAY_BONUS = You have played ^3%d h.^4 in a row, and awarded ^3%d$^4 bonus
But not this particular one:

Code:
    colorChat(id, CHATCOLOR_GREEN, "* %L", id, "YOUR_RANK_IS", iRankPos, iRankMax, izStats[STATS_KILLS], izStats[STATS_HITS], ((effec(izStats) + accuracy(izStats)) / 2))

->

Code:
    client_print_color(id, id, "^4* %L", id, "YOUR_RANK_IS", iRankPos, iRankMax, izStats[STATS_KILLS], izStats[STATS_HITS], ((effec(izStats) + accuracy(izStats)) / 2))

Thanks for the replies.


All times are GMT -4. The time now is 04:35.

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