AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Few errors, Any help? (https://forums.alliedmods.net/showthread.php?t=244507)

proffs 07-19-2014 14:07

Few errors, Any help?
 
Quote:

L 07/19/2014 - 19:13:34: [AMXX] Displaying debug trace (plugin "bm.amxx", version "1.0")
L 07/19/2014 - 19:13:34: [AMXX] Run time error 4: index out of bounds
L 07/19/2014 - 19:13:34: [AMXX] [0] bm.sma::ShowPropertiesMenu (line 4009)
L 07/19/2014 - 19:13:34: [AMXX] [1] bm.sma::SetPropertiesBlockAiming (line 5788)
L 07/19/2014 - 19:13:34: [AMXX] [2] bm.sma::HandleBlockMenu (line 4386)
L 07/19/2014 - 19:13:34: [AMXX] Displaying debug trace (plugin "bm.amxx", version "1.0")
L 07/19/2014 - 19:13:34: [AMXX] Run time error 4: index out of bounds
L 07/19/2014 - 19:13:34: [AMXX] [0]bm.sma::FwdCmdStart (line 1514)
PHP Code:

public FwdCmdStart(idhandle)
{
        if ( !
g_connected[id] ) return FMRES_IGNORED;
       
        static 
buttonsoldbuttons;
        
buttons =       get_uc(handleUC_Buttons);
        
oldbuttons =    entity_get_int(idEV_INT_oldbuttons);
       
        if ( 
g_alive[id]
        && ( 
buttons IN_USE )
        && !( 
oldbuttons IN_USE )
        && !
g_has_hud_text[id] )
        {
                static 
entbody;
                
get_user_aiming(identbody9999);
               
                if ( 
IsBlock(ent) )
                {
                        static 
block_type;
                        
block_type entity_get_int(entEV_INT_body);
                       
                        static 
property[5];
                       
                        static 
message[512], len;
                        
len format(messagecharsmax(message), "%s %s^nType: %s"PLUGIN_PREFIXPLUGIN_VERSIONg_block_names[block_type]);
                       
                        if ( 
g_property1_name[block_type][0] )
                        {
                                
GetProperty(ent1property);
                               
                                if ( ( 
block_type == BUNNYHOP
                                
|| block_type == ICEBHOP
                                
|| block_type == NO_SLOW_DOWN_BUNNYHOP )
                                && 
property[0] == '1' )
                                {
                                        
len += format(message[len], charsmax(message) - len"^n%s"g_property1_name[block_type]);
                                }
                                else if ( 
block_type == SLAP )
                                {
                                        
len += format(message[len], charsmax(message) - len"^n%s: %s"g_property1_name[block_type], property[0] == '3' "High" property[0] == '2' "Medium" "Low");
                                }
                                else if ( 
block_type == SUFFER
                                
|| block_type == HE_GRENADE
                                
|| block_type == FLASHBANG
                                
|| block_type == SMOKE_GRENADE )
                                {
                                        
len += format(message[len], charsmax(message) - len"^n%s: %s"g_property1_name[block_type], property[0] == '3' "Counter-Terrorists" property[0] == '2' "Terrorists" "All");
                                }
                                else if( 
block_type == WEAPON_BLOCK)                                   
                                {
                                        
len += format(message[len], charsmax(message) - len"^n%s: %s"g_property1_name[block_type], g_szWeaponNames2[str_to_num(property)]);
                                }
                                else if ( 
block_type != BUNNYHOP
                                
&& block_type != ICEBHOP
                 
&& block_type != NO_SLOW_DOWN_BUNNYHOP )
                                {
                                        
len += format(message[len], charsmax(message) - len"^n%s: %s"g_property1_name[block_type], property);
                                }
                        }
                        if ( 
g_property2_name[block_type][0] )
                        {
                                
GetProperty(ent2property);
                               
                                
len += format(message[len], charsmax(message) - len"^n%s: %s"g_property2_name[block_type], property);
                        }
                        if ( 
g_property3_name[block_type][0] )
                        {
                                
GetProperty(ent3property);
                               
                                if ( 
block_type == BOOTS_OF_SPEED
                                
|| property[0] != '0'
                                
&& !( property[0] == '2' && property[1] == '5' && property[2] == '5' ) )
                                {
                                        
len += format(message[len], charsmax(message) - len"^n%s: %s"g_property3_name[block_type], property);
                                }
                        }
                        if ( 
g_property4_name[block_type][0] )
                        {
                                
GetProperty(ent4property);
                                if(
block_type == WEAPON_BLOCK)
                                {
                                        
len += format(message[len], charsmax(message) - len"^n%s: %s"g_property4_name[block_type], property[0] == '3' "All" property[0] == '2' "Counter-Terrorists" "Terrorists");
                                }
                                else
                                {
                                        
len += format(message[len], charsmax(message) - len"^n%s: %s"g_property4_name[block_type], property[0] == '1' "Yes" "No");
                                }
                        }
                       
                        
set_hudmessage(gHudRedgHudGreengHudBluegfTextXgfTextYgHudEffectsgfHudFxTimegfHudHoldTimegfHudFadeInTimegfHudFadeOutTimegHudChannel);
                        
show_hudmessage(idmessage);
                               
                }
                else if ( 
IsLight(ent) )
                {
                        static 
property1[5], property2[5], property3[5], property4[5];
                       
                        
GetProperty(ent1property1);
                        
GetProperty(ent2property2);
                        
GetProperty(ent3property3);
                        
GetProperty(ent4property4);
                       
                        
set_hudmessage(gHudRedgHudGreengHudBluegfTextXgfTextYgHudEffectsgfHudFxTimegfHudHoldTimegfHudFadeInTimegfHudFadeOutTimegHudChannel);
                        
show_hudmessage(id"Type: Light^nRadius: %s^nColor Red: %s^nColor Green: %s^nColor Blue: %s"property1property2property3property4);
                }
                else if ( 
IsBox(ent) )
                {
                        static 
property1[5], property2[5], property3[5], property4[5];
                       
                        
GetProperty(ent1property1);
                        
GetProperty(ent2property2);
                        
GetProperty(ent3property3);
                        
GetProperty(ent4property4);
                       
                        
set_hudmessage(gHudRedgHudGreengHudBluegfTextXgfTextYgHudEffectsgfHudFxTimegfHudHoldTimegfHudFadeInTimegfHudFadeOutTimegHudChannel);
                        
show_hudmessage(id"Type: Box^nRadius: %s^nColor Red: %s^nColor Green: %s^nColor Blue: %s"property1property2property3property4);    
                       
                }
        }
        if ( !
g_grabbed[id] ) return FMRES_IGNORED;
       
        if ( ( 
buttons IN_JUMP )
        && !( 
oldbuttons IN_JUMP ) ) if ( g_grab_length[id] > 72.0 g_grab_length[id] -= 16.0;
       
        if ( ( 
buttons IN_DUCK )
        && !( 
oldbuttons IN_DUCK ) ) g_grab_length[id] += 16.0;
       
        if ( ( 
buttons IN_ATTACK )
        && !( 
oldbuttons IN_ATTACK ) ) CmdAttack(id);
       
        if ( ( 
buttons IN_ATTACK2 )
        && !( 
oldbuttons IN_ATTACK2 ) ) CmdAttack2(id);
       
        if ( ( 
buttons IN_RELOAD )
        && !( 
oldbuttons IN_RELOAD ) )
        {
                
CmdRotate(id);
                
set_uc(handleUC_Buttonsbuttons & ~IN_RELOAD);
        }
       
        if ( !
is_valid_ent(g_grabbed[id]) )
        {
                
CmdRelease(id);
                return 
FMRES_IGNORED;
        }
       
        if ( !
IsBlockInGroup(idg_grabbed[id])
        || 
g_group_count[id] < )
        {
                
MoveGrabbedEntity(id);
                return 
FMRES_IGNORED;
        }
       
        static 
block;
        static 
Float:move_to[3];
        static 
Float:offset[3];
        static 
Float:origin[3];
       
        
MoveGrabbedEntity(idmove_to);
       
        for ( new 
0<= g_group_count[id]; ++)
        {
                
block g_grouped_blocks[id][i];
               
                if ( !
IsBlockInGroup(idblock) ) continue;
               
                
entity_get_vector(blockEV_VEC_vuser1offset);
               
                
origin[0] = move_to[0] - offset[0];
                
origin[1] = move_to[1] - offset[1];
                
origin[2] = move_to[2] - offset[2];
               
                
MoveEntity(idblockoriginfalse);
        }
       
        return 
FMRES_IGNORED;


PHP Code:

ShowPropertiesMenu(ident)
{
        new 
menu[256], title[32], entry[64], property[5], line1[3], line2[3], line3[3], line4[3], numblock_type;
       
        
block_type entity_get_int(entEV_INT_body);
       
        
format(titlecharsmax(title), "\r[%s] \ySet Properties^n^n"PLUGIN_PREFIX);
        
add(menucharsmax(menu), title);
       
        if ( 
g_property1_name[block_type][0] )
        {
                
GetProperty(ent1property);
               
                if ( 
block_type == BUNNYHOP
                
|| block_type == ICEBHOP
                
|| block_type == NO_SLOW_DOWN_BUNNYHOP )
                {
                        
format(entrycharsmax(entry), "\r1. \w%s: %s^n"g_property1_name[block_type], property[0] == '1' "\yOn" "\rOff");
                }
                else if ( 
block_type == SLAP )
                {
                        
format(entrycharsmax(entry), "\r1. \w%s: \y%s^n"g_property1_name[block_type], property[0] == '3' "High" property[0] == '2' "Medium" "Low");
                }
                else if ( 
block_type == WEAPON_BLOCK )
                {
                        
format(entrycharsmax(entry), "\r1. \w%s: \y%s^n"g_property1_name[block_type], g_szWeaponNames2[str_to_num(property)]);
                }
                else if ( 
block_type == SUFFER
                
|| block_type == HE_GRENADE
                
|| block_type == FLASHBANG
                
|| block_type == SMOKE_GRENADE )
                {
                        
format(entrycharsmax(entry), "\r1. \w%s: \y%s^n"g_property1_name[block_type], property[0] == '3' "Counter-Terrorists" property[0] == '2' "Terrorists" "All");
                }
                else
                {
                        
format(entrycharsmax(entry), "\r1. \w%s: \y%s^n"g_property1_name[block_type], property);
                }
               
                
add(menucharsmax(menu), entry);
        }
        else
        {
                
format(line1charsmax(line1), "^n");
        }
       
        if ( 
g_property2_name[block_type][0] )
        {
                if ( 
g_property1_name[block_type][0] )
                {
                        
num 2;
                }
                else
                {
                        
num 1;
                }
               
                
GetProperty(ent2property);
               
                
format(entrycharsmax(entry), "\r%d. \w%s: \y%s^n"numg_property2_name[block_type], property);
               
                
add(menucharsmax(menu), entry);
        }
        else
        {
                
format(line2charsmax(line2), "^n");
        }
       
        if ( 
g_property3_name[block_type][0] )
        {
                if ( 
g_property1_name[block_type][0] && g_property2_name[block_type][0] )
                {
                        
num 3;
                }
                else if ( 
g_property1_name[block_type][0]
                || 
g_property2_name[block_type][0] )
                {
                        
num 2;
                }
                else
                {
                        
num 1;
                }
               
                
GetProperty(ent3property);
               
                if ( 
block_type == BOOTS_OF_SPEED
                
|| property[0] != '0' && !( property[0] == '2' && property[1] == '5' && property[2] == '5' ) )
                {
                        
format(entrycharsmax(entry), "\r%d. \w%s: \y%s^n"numg_property3_name[block_type], property);
                }
                else
                {
                        
format(entrycharsmax(entry), "\r%d. \w%s: \rOff^n"numg_property3_name[block_type]);
                }
               
                
add(menucharsmax(menu), entry);
        }
        else
        {
                
format(line3charsmax(line3), "^n");
        }
       
        if ( 
g_property4_name[block_type][0] )
        {
                if ( 
g_property1_name[block_type][0] && g_property2_name[block_type][0] && g_property3_name[block_type][0] )
                {
                        
num 4;
                }
                else if ( 
g_property1_name[block_type][0] && g_property2_name[block_type][0]
                || 
g_property1_name[block_type][0] && g_property3_name[block_type][0]
                || 
g_property2_name[block_type][0] && g_property3_name[block_type][0] )
                {
                        
num 3;
                }
                else if ( 
g_property1_name[block_type][0]
                || 
g_property2_name[block_type][0]
                || 
g_property3_name[block_type][0] )
                {
                        
num 2;
                }
                else
                {
                        
num 1;
                }
               
                
GetProperty(ent4property);
                if(
block_type == WEAPON_BLOCK)
                {
                        
format(entrycharsmax(entry), "\r%d. \w%s: \y%s^n"numg_property4_name[block_type], property[0] == '3' "All" property[0] == '2' "Counter-Terrorists" "Terrorists");
                }
                else
                {
                        
format(entrycharsmax(entry), "\r%d. \w%s: %s^n"numg_property4_name[block_type], property[0] == '1' "\yYes" "\rNo");
                }
                
add(menucharsmax(menu), entry);
        }
        else
        {
                
format(line4charsmax(line4), "^n");
        }
       
        
g_property_info[id][1] = ent;
       
        
add(menucharsmax(menu), line1);
        
add(menucharsmax(menu), line2);
        
add(menucharsmax(menu), line3);
        
add(menucharsmax(menu), line4);
        
add(menucharsmax(menu), "^n^n^n^n^n^n\r0. \wBack");
       
        
show_menu(idg_keys_properties_menumenu, -1"BmPropertiesMenu");


PHP Code:

SetPropertiesBlockAiming(id)
{
        
ShowPropertiesMenu(ident);
       
        return 
PLUGIN_HANDLED;



Line 4009:
PHP Code:

                       format(entrycharsmax(entry), "\r1. \w%s: \y%s^n"g_property1_name[block_type], g_szWeaponNames2[str_to_num(property)]); 

Line: 1514
PHP Code:

                                        len += format(message[len], charsmax(message) - len"^n%s: %s"g_property1_name[block_type], g_szWeaponNames2[str_to_num(property)]); 


Black Rose 07-19-2014 14:56

Re: Few errors, Any help?
 
You don't even tell us which line is 4009 or 1514.

proffs 07-19-2014 15:26

Re: Few errors, Any help?
 
Quote:

Originally Posted by Black Rose (Post 2170500)
You don't even tell us which line is 4009 or 1514.

Done, sorry for that xD

YamiKaitou 07-19-2014 19:30

Re: Few errors, Any help?
 
Either block_type exceeds the size of g_property1_name or property exceeds the size of g_szWeaponNames2. You will need to debug it to determine which one is causing it

proffs 07-19-2014 19:47

Re: Few errors, Any help?
 
Quote:

Originally Posted by YamiKaitou (Post 2170599)
Either block_type exceeds the size of g_property1_name or property exceeds the size of g_szWeaponNames2. You will need to debug it to determine which one is causing it

How can It exceed the size of those too if I've got it like this?
PHP Code:

#define WEAPON_SIZE sizeof(g_szWeaponNames)
 
new const g_iWeaponIDs[WEAPON_SIZE] =
{
        
CSW_P228,
        
CSW_SCOUT,
        
CSW_HEGRENADE,
        
CSW_XM1014,
        
CSW_MAC10,
        
CSW_AUG,
        
CSW_SMOKEGRENADE,
        
CSW_ELITE,
        
CSW_FIVESEVEN,
        
CSW_UMP45,
        
CSW_SG550,
        
CSW_GALIL,
        
CSW_FAMAS,
        
CSW_USP,
        
CSW_GLOCK18,
        
CSW_AWP,
        
CSW_MP5NAVY,
        
CSW_M249,
        
CSW_M3,
        
CSW_M4A1,
        
CSW_TMP,
        
CSW_G3SG1,
        
CSW_FLASHBANG,
        
CSW_DEAGLE,
        
CSW_SG552,
        
CSW_AK47,
        
CSW_P90
};

new const 
g_szWeaponNames2[WEAPON_SIZE][] =
{
        
"P228",
        
"Scout",              
        
"He-Grenade",              
        
"XM1014",                    
        
"Mac10",            
        
"Aug",
        
"Smoke-Grenade",            
        
"Elite",          
        
"Fiveseven",
        
"Ump45",              
        
"SG550",
        
"Galil",  
        
"Famas",
        
"USP",  
        
"Glock",  
        
"AWP",  
        
"MP5",    
        
"M249",            
        
"M3",  
        
"M4A1",                
        
"TMP",      
        
"G3SG1",    
        
"FlashBang",            
        
"Deagle",
        
"SG552",
        
"AK47",                  
        
"P90"
}; 

PHP Code:

enum
{
        
PLATFORM,
        
BUNNYHOP,
        
DAMAGE,
        
HEALER,
        
NO_FALL_DAMAGE,
        
ICE,
        
TRAMPOLINE,
        
SPEED_BOOST,
        
DEATH,
        
LOW_GRAVITY,
        
SLAP,
        
HONEY,
        
CT_BARRIER,
        
T_BARRIER,
        
GLASS,
        
NO_SLOW_DOWN_BUNNYHOP,
        
DELAYED_BUNNYHOP,
        
INVINCIBILITY,
        
STEALTH,
        
BOOTS_OF_SPEED,
        
CAMOUFLAGE//CAMOUFLAGE
        
SUPERMAN//SUPERMAN
        
AWP//AWP
        
DEAGLE//DEAGLE
        
SHOTGUN//SHOTGUN
        
RIFLES//RIFLES
        
PISTOLS//PISTOLS
        
HE_GRENADE//HE_GRENADE
        
FLASHBANG//FLASHBANG
        
SMOKE_GRENADE//SMOKEGRENADE
        
NADES//NADES
        
DUCK//DUCK
        
MONEYGIVER//MONEYGIVER
        
BLINDTRAP//BLIND
        
POISON//POISON
        
ANTIDOTE//ANTIDOTE
        
SUFFER//SUFFER
        
XP//XP
        
ARMOR//ARMOR
        
QUAKE//QUAKE
        
MUSIC//MUSIC
        
WEAPON_BLOCK,
        
ICEBHOP,
       
        
TOTAL_BLOCKS
}; 


YamiKaitou 07-19-2014 19:50

Re: Few errors, Any help?
 
Since we don't know the value of either variable, we cannot answer that

proffs 07-19-2014 19:52

Re: Few errors, Any help?
 
Quote:

Originally Posted by YamiKaitou (Post 2170605)
Since we don't know the value of either variable, we cannot answer that

PHP Code:

new g_selected_block_type[TOTAL_BLOCKS]; 

PHP Code:

 static block_type;
block_type entity_get_int(entEV_INT_body); 


YamiKaitou 07-19-2014 19:57

Re: Few errors, Any help?
 
You need to debug it, we cannot help you until you do so


All times are GMT -4. The time now is 13:19.

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