AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   War3ft Mod new version error. (https://forums.alliedmods.net/showthread.php?t=336176)

Zore93 02-01-2022 13:26

War3ft Mod new version error.
 
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!

OciXCrom 02-01-2022 13:52

Re: War3ft Mod new version error.
 
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.

Zore93 02-01-2022 14:30

Re: War3ft Mod new version error.
 
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!

OciXCrom 02-01-2022 14:36

Re: War3ft Mod new version error.
 
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.

Zore93 02-01-2022 15:18

Re: War3ft Mod new version error.
 
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.


All times are GMT -4. The time now is 11:31.

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