AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Runtime error 4: index out of bounds (https://forums.alliedmods.net/showthread.php?t=326530)

Abhinash 08-04-2020 16:35

Runtime error 4: index out of bounds
 
I am getting runtime error 4 on this simple part of code.
Can anyone help me to fix it ?
Code:

// Current Weapon info
public message_cur_weapon(id)
{
        // Not alive or zombie
        if (!g_isalive[id] || g_zombie[id])
                return;
       
        if (g_sniper[id])
                return;
       
        if (b_uAmmo[id])
        {
                //set_pdata_int(get_pdata_cbase(id, 373), 51, 100, 4)
               
                // HUD should show full clip all the time
                set_msg_arg_int(3, get_msg_argtype(3), MAXCLIP[weapon])
        }
}

Error on this line : if (!g_isalive[id] || g_zombie[id])

OciXCrom 08-04-2020 16:58

Re: Runtime error 4: index out of bounds
 
Show how the variables are defined.

Abhinash 08-04-2020 18:41

Re: Runtime error 4: index out of bounds
 
Quote:

Originally Posted by OciXCrom (Post 2713017)
Show how the variables are defined.

Every variable defined with value 33.
But, I fixed it.
Actually, the message function was not working without 3 variables, i.e. msg_id, msg_dest, msg_ent.

I wonder, what the difference between CurWeapon event vs CurWeapon message


All times are GMT -4. The time now is 17:50.

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