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

War3ft Mod new version error.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zore93
New Member
Join Date: Feb 2022
Old 02-01-2022 , 13:26   War3ft Mod new version error.
Reply With Quote #1

Hi Guys,

I work at a new version for war3ft mod for CS 1.6 server.

I have just one error, with debug enabled:
Code:
L 02/01/2022 - 20:17:58: [AMXX] Displaying debug trace (plugin "war3ft.amxx", version "RC15 2018")
L 02/01/2022 - 20:17:58: [AMXX] Run time error 4: index out of bounds 
L 02/01/2022 - 20:17:58: [AMXX]    [0] war3ft.sma::client_PostThink (line 574)
L 02/01/2022 - 20:17:58: [AMXX] Displaying debug trace (plugin "war3ft.amxx", version "RC15 2018")
L 02/01/2022 - 20:17:58: [AMXX] Run time error 4: index out of bounds 
L 02/01/2022 - 20:17:58: [AMXX]    [0] war3ft.sma::client_PostThink (line 574)
L 02/01/2022 - 20:17:58: [AMXX] Displaying debug trace (plugin "war3ft.amxx", version "RC15 2018")
L 02/01/2022 - 20:17:58: [AMXX] Run time error 4: index out of bounds 
L 02/01/2022 - 20:17:58: [AMXX]    [0] war3ft.sma::client_PostThink (line 574)
With no debug enabled:
Code:
L 02/01/2022 - 20:27:46: [AMXX] Run time error 4 (plugin "war3ft.amxx") - debug not enabled!
L 02/01/2022 - 20:27:46: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 02/01/2022 - 20:27:46: [AMXX] Run time error 4 (plugin "war3ft.amxx") - debug not enabled!
L 02/01/2022 - 20:27:46: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 02/01/2022 - 20:27:46: [AMXX] Run time error 4 (plugin "war3ft.amxx") - debug not enabled!
And my script at that public function is this one:

Code:
public client_PostThink(id)
{


	if (!is_user_alive(id))
		return
		
	static iSkillLevel;
	iSkillLevel = SM_GetSkillLevel( id, SKILL_CYCLONE ); 
	
	if (!iSkillLevel)
		return
		
	if(g_icon_delay[id] + WALL_ICON_DELAY > get_gametime())
		return
		
	g_icon_delay[id] = get_gametime()
	
	
	for( new iPlayer = 1; iPlayer <= g_iMaxPlayers; iPlayer++ )
			{
				if( get_user_team(id) != get_user_team(iPlayer) && is_user_alive( iPlayer ) && get_user_health(iPlayer) <= p_cyclone[iSkillLevel-1] && is_user_connected(id) && is_user_connected(iPlayer) )
				{
					create_icon_origin(id, iPlayer, g_supplybox_icon_id)		
				}
			}
			

}
And those error repeating for unlimited number of times.
What I did wrong?
Thank you!

Last edited by Zore93; 02-01-2022 at 13:29.
Zore93 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-01-2022 , 13:52   Re: War3ft Mod new version error.
Reply With Quote #2

The error with debug disabled provides no use.

The debug version says which line the error is on. You didn't mention which line is that in the code you provided.

"Index out of bounds" means that you're using a variable outside of its defined dimensions, e.g. if you defined it as player[33], trying to access player[34] (or even 33 itself) will output this error.

Show which line is mentioned in the error and show how the variables on that line are defined.

I assume p_cyclone[iSkillLevel-1] is the problem, unless you defined g_icon_delay with a size of less than 33.
__________________

Last edited by OciXCrom; 02-01-2022 at 13:53.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Zore93
New Member
Join Date: Feb 2022
Old 02-01-2022 , 14:30   Re: War3ft Mod new version error.
Reply With Quote #3

Hey ,

This is the entire sma file: https://easyupload.io/yb567s

It say about row 574 -> cs_get_user_team(id)

But I changed from cs_get_user_team(id) to get_user_team(id) still doesn't work.
@OciXCrom thank you for trying helping me!

Last edited by Zore93; 02-01-2022 at 14:31.
Zore93 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-01-2022 , 14:36   Re: War3ft Mod new version error.
Reply With Quote #4

Row 574 has tons of functions, it's not just cs_get_user_team() and like I said, this is caused by a variable, not a function.

Code:
// Row 574: if( cs_get_user_team(id) != cs_get_user_team(iPlayer) && is_user_alive( iPlayer ) && get_user_health(iPlayer) <= p_cyclone[iSkillLevel-1] && is_user_connected(id) && is_user_connected(iPlayer) )

Show the definition of "p_cyclone". It's not in the main .sma file.

Also, checking if the user is connected after using cs_get_user_team() is wrong and will output an error (different from this one) if he isn't. Always check if he's connected before using other functions on him.

You don't need to check if "id" is connected. client_PostThink() cannot be called on a disconnected player, plus you are already checking if he's alive, which also check if he's connected.
__________________

Last edited by OciXCrom; 02-01-2022 at 14:37.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Zore93
New Member
Join Date: Feb 2022
Old 02-01-2022 , 15:18   Re: War3ft Mod new version error.
Reply With Quote #5

Yea, I didn't get to work unfortunately....

For ones who want to do more on this mod here is all the files: https://easyupload.io/v6j1gt

@OciXCrom Thank you for your support.
Zore93 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 04:01.


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