Raised This Month: $51 Target: $400
 12% 

Problem with float.inc


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TheiOne
Member
Join Date: Mar 2017
Old 05-15-2018 , 07:46   Problem with float.inc
Reply With Quote #1

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.
TheiOne is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 05-15-2018 , 10:25   Re: Problem with float.inc
Reply With Quote #2

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); }
__________________









Last edited by CrazY.; 05-15-2018 at 10:30.
CrazY. is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 05-15-2018 , 12:40   Re: Problem with float.inc
Reply With Quote #3

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.
__________________
klippy is offline
TheiOne
Member
Join Date: Mar 2017
Old 05-16-2018 , 10:44   Re: Problem with float.inc
Reply With Quote #4

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:
Attached Files
File Type: zip StatsX Shell (Ultimate StatsX).zip (122.6 KB, 45 views)

Last edited by TheiOne; 05-16-2018 at 10:49. Reason: Added the attachment
TheiOne is offline
TheiOne
Member
Join Date: Mar 2017
Old 06-03-2018 , 17:47   Re: Problem with float.inc
Reply With Quote #5

bump
TheiOne is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-03-2018 , 18:06   Re: Problem with float.inc
Reply With Quote #6

Quote:
Originally Posted by TheiOne View Post
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.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 06-03-2018 at 18:11.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-03-2018 , 18:12   Re: Problem with float.inc
Reply With Quote #7

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).
__________________
fysiks is offline
TheiOne
Member
Join Date: Mar 2017
Old 06-03-2018 , 20:55   Re: Problem with float.inc
Reply With Quote #8

@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.
TheiOne 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 08:53.


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