View Single Post
Author Message
N3v3rM1nd
Junior Member
Join Date: Apr 2021
Old 07-21-2021 , 16:20   Index out of bound
#1

PHP Code:
#include amxmodx

new iNormalVotes[2], iSpeedVotes[4], iJumpsVotes[3]

public 
_reset_votes()
{
arrayset(iNormalVotes0sizeof(iNormalVotes))
arrayset(iSpeedVotes0sizeof(iSpeedVotes))
arrayset(iJumpsVotes0sizeof(iJumpsVotes))
}

public 
vote_smth(idmenuitem)
{
iNormalVotes[item]++ // index out of bounds

switch(item)
{
case 
0// print smth
case 1// print smth
}

return 
PLUGIN_HANDLED
}

public 
vote_smth2(idmenuitem)
{
iSpeedVotes[item]++ // index out of bounds

switch(item)
{
case 
0// print smth
case 1// print smth
case 2// print smth
case 3// print smth
}
return 
PLUGIN_HANDLED
}

public 
vote_smth2(idmenuitem)
{
iJumpsVotes[item]++

switch(
item)
{
case 
0// print smth
case 1// print smth
case 2// print smth
}
return 
PLUGIN_HANDLED
}

public 
vote_smth3(idmenuitem)
{
iNormalVotes[item]++ // index out of bounds

switch(item)
{
case 
0// print smth
case 1// print smth
}
return 
PLUGIN_HANDLED
}

public 
vote_smth4(idmenuitem)
{
iNormalVotes[item]++ // index out of bounds

switch(item)
{
case 
0// print smth
case 1// print smth

}
return 
PLUGIN_HANDLED

the problem is when the variable is incremented the result is index out of bounds

Last edited by Bugsy; 07-21-2021 at 17:10. Reason: removed
N3v3rM1nd is offline