PDA

View Full Version : Fixing Run Time Errors


BigMac
06-11-2010, 23:42
[AMXX][0] team_semiclip.sma::client_PostThink (line 156)
[AMXX] Displaying debug trace (plugin "semiclip.amxx")
[AMXX] Run time error 4: index out of bounds
[AMXX][0] team_semiclip.sma::Ham_CBasePlayer_PreThink_P ost (line 136)
[AMXX] Displaying debug trace (plugin "semiclip.amxx")
[AMXX] Run time error 4: index out of bounds



#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
new const VERSION[] = "0.0.2" // 22jan2010
const MAX_PLAYERS = 32
new g_bAlive
#define MarkUserAlive(%1) g_bAlive |= 1<<(%1 & 31)
#define ClearUserAlive(%1) g_bAlive &= ~( 1<<(%1 & 31) )
#define IsAlive(%1) g_bAlive & 1<<(%1 & 31)
new g_iTeam[MAX_PLAYERS+1]
new const g_szTeams[][] = {
"",
"TERRORIST",
"CT",
""
}
enum {
_T = 1,
_CT
}
new g_iTeamSemiclip = _T | _CT
public plugin_init()
{
register_plugin("Team SemiClip", VERSION, "ConnorMcLeod")
RegisterHam(Ham_Spawn, "player", "Ham_CBasePlayer_Spawn_Post", 1)
RegisterHam(Ham_Killed, "player", "Ham_CBasePlayer_Killed_Post", 1)

register_forward(FM_AddToFullPack, "FM_client_AddToFullPack_Post", 1)
RegisterHam(Ham_Player_PreThink, "player", "Ham_CBasePlayer_PreThink_Post", 1)
register_concmd("team_semiclip", "ConsoleCommand_TeamSemiclip", ADMIN_CFG)
}
public ConsoleCommand_TeamSemiclip( id , level , cid )
{
if( cmd_access(id, level, cid, 2) )
{
new szArg[2]
read_argv(1, szArg, charsmax(szArg))
g_iTeamSemiclip = clamp(str_to_num(szArg), 0, 3)
}
return PLUGIN_HANDLED
}
public client_putinserver( id )
{
ClearUserAlive(id)
}
public client_disconnect( id )
{
ClearUserAlive(id)
}
public Ham_CBasePlayer_Spawn_Post( id )
{
if( is_user_alive(id) )
{
MarkUserAlive(id)
const XTRA_OFS_PLAYER = 5
const m_iTeam = 114
g_iTeam[id] = get_pdata_int(id, m_iTeam, XTRA_OFS_PLAYER)
}
else
{
ClearUserAlive(id)
}
}
public Ham_CBasePlayer_Killed_Post( id )
{
if( is_user_alive(id) )
{
MarkUserAlive(id)
}
else
{
ClearUserAlive(id)
}
}
public FM_client_AddToFullPack_Post(es, e, iEnt, id, hostflags, player, pSet)
{
if( player
&& id != iEnt
&& IsAlive(id)
&& g_iTeamSemiclip & g_iTeam[id]
&& IsAlive(iEnt)
&& g_iTeam[id] == g_iTeam[iEnt]
&& get_orig_retval() )
{
set_es(es, ES_Solid, SOLID_NOT)
set_es(es, ES_RenderMode, kRenderTransAlpha)
set_es(es, ES_RenderAmt, 250)
}
}
public Ham_CBasePlayer_PreThink_Post(id)
{
if( IsAlive(id) == 0 || !(g_iTeamSemiclip & g_iTeam[id]) )
{
return
}
new iPlayers[MAX_PLAYERS], iNum, iPlayer
get_players(iPlayers, iNum, "ae", g_szTeams[g_iTeam[id]])
for(new i; i<iNum; i++)
{
iPlayer = iPlayers[i]
if( id != iPlayer )
{
entity_set_int(iPlayer, EV_INT_solid, SOLID_NOT)
}
}
}
public client_PostThink(id)
{
if( IsAlive(id) == 0 || !(g_iTeamSemiclip & g_iTeam[id]) )
{
return
}
new iPlayers[MAX_PLAYERS], iNum, iPlayer
get_players(iPlayers, iNum, "ae", g_szTeams[g_iTeam[id]])
for(new i; i<iNum; i++)
{
iPlayer = iPlayers[i]
if( id != iPlayer )
{
entity_set_int(iPlayer, EV_INT_solid, SOLID_SLIDEBOX)
}
}
}


Thanks:wink:

fysiks
06-11-2010, 23:50
Did you change something before these errors happened? BTW, The code you posted is only 125 lines long so those line numbers don't help much at all.

BigMac
06-11-2010, 23:55
/* Formatright © 2009, ConnorMcLeod
Team SemiClip is free software;
you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Team SemiClip; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
new const VERSION[] = "0.0.2" // 22jan2010
const MAX_PLAYERS = 32
new g_bAlive
#define MarkUserAlive(%1) g_bAlive |= 1<<(%1 & 31)
#define ClearUserAlive(%1) g_bAlive &= ~( 1<<(%1 & 31) )
#define IsAlive(%1) g_bAlive & 1<<(%1 & 31)
new g_iTeam[MAX_PLAYERS+1]
new const g_szTeams[][] = {
"",
"TERRORIST",
"CT",
""
}
enum {
_T = 1,
_CT
}
new g_iTeamSemiclip = _T | _CT
public plugin_init()
{
register_plugin("Team SemiClip", VERSION, "ConnorMcLeod")
RegisterHam(Ham_Spawn, "player", "Ham_CBasePlayer_Spawn_Post", 1)
RegisterHam(Ham_Killed, "player", "Ham_CBasePlayer_Killed_Post", 1)

register_forward(FM_AddToFullPack, "FM_client_AddToFullPack_Post", 1)
RegisterHam(Ham_Player_PreThink, "player", "Ham_CBasePlayer_PreThink_Post", 1)
register_concmd("team_semiclip", "ConsoleCommand_TeamSemiclip", ADMIN_CFG)
}
public ConsoleCommand_TeamSemiclip( id , level , cid )
{
if( cmd_access(id, level, cid, 2) )
{
new szArg[2]
read_argv(1, szArg, charsmax(szArg))
g_iTeamSemiclip = clamp(str_to_num(szArg), 0, 3)
}
return PLUGIN_HANDLED
}
public client_putinserver( id )
{
ClearUserAlive(id)
}
public client_disconnect( id )
{
ClearUserAlive(id)
}
public Ham_CBasePlayer_Spawn_Post( id )
{
if( is_user_alive(id) )
{
MarkUserAlive(id)
const XTRA_OFS_PLAYER = 5
const m_iTeam = 114
g_iTeam[id] = get_pdata_int(id, m_iTeam, XTRA_OFS_PLAYER)
}
else
{
ClearUserAlive(id)
}
}
public Ham_CBasePlayer_Killed_Post( id )
{
if( is_user_alive(id) )
{
MarkUserAlive(id)
}
else
{
ClearUserAlive(id)
}
}
public FM_client_AddToFullPack_Post(es, e, iEnt, id, hostflags, player, pSet)
{
if( player
&& id != iEnt
&& IsAlive(id)
&& g_iTeamSemiclip & g_iTeam[id]
&& IsAlive(iEnt)
&& g_iTeam[id] == g_iTeam[iEnt]
&& get_orig_retval() )
{
set_es(es, ES_Solid, SOLID_NOT)
set_es(es, ES_RenderMode, kRenderTransAlpha)
set_es(es, ES_RenderAmt, 250)
}
}
public Ham_CBasePlayer_PreThink_Post(id)
{
if( IsAlive(id) == 0 || !(g_iTeamSemiclip & g_iTeam[id]) )
{
return
}
new iPlayers[MAX_PLAYERS], iNum, iPlayer
get_players(iPlayers, iNum, "ae", g_szTeams[g_iTeam[id]])
for(new i; i<iNum; i++)
{
iPlayer = iPlayers[i]
if( id != iPlayer )
{
entity_set_int(iPlayer, EV_INT_solid, SOLID_NOT)
}
}
}
public client_PostThink(id)
{
if( IsAlive(id) == 0 || !(g_iTeamSemiclip & g_iTeam[id]) )
{
return
}
new iPlayers[MAX_PLAYERS], iNum, iPlayer
get_players(iPlayers, iNum, "ae", g_szTeams[g_iTeam[id]])
for(new i; i<iNum; i++)
{
iPlayer = iPlayers[i]
if( id != iPlayer )
{
entity_set_int(iPlayer, EV_INT_solid, SOLID_SLIDEBOX)
}
}
}


Sorry here you go

fysiks
06-11-2010, 23:57
Did you change something before these errors happened?


It was written by Connor so at one point it worked.


BTW, The code you posted is only 125 138 lines long so those line numbers don't help much at all.

BigMac
06-12-2010, 00:02
/* Formatright © 2009, ConnorMcLeod
Team SemiClip is free software;
you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Team SemiClip; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
new const VERSION[] = "0.0.2" // 22jan2010
const MAX_PLAYERS = 32
new g_bAlive
#define MarkUserAlive(%1) g_bAlive |= 1<<(%1 & 31)
#define ClearUserAlive(%1) g_bAlive &= ~( 1<<(%1 & 31) )
#define IsAlive(%1) g_bAlive & 1<<(%1 & 31)
new g_iTeam[MAX_PLAYERS+1]
new const g_szTeams[][] = {
"",
"TERRORIST",
"CT",
""
}
enum {
_T = 1,
_CT
}
new g_iTeamSemiclip = _T | _CT
public plugin_init()
{
register_plugin("Team SemiClip", VERSION, "ConnorMcLeod")
RegisterHam(Ham_Spawn, "player", "Ham_CBasePlayer_Spawn_Post", 1)
RegisterHam(Ham_Killed, "player", "Ham_CBasePlayer_Killed_Post", 1)

register_forward(FM_AddToFullPack, "FM_client_AddToFullPack_Post", 1)
RegisterHam(Ham_Player_PreThink, "player", "Ham_CBasePlayer_PreThink_Post", 1)
register_concmd("team_semiclip", "ConsoleCommand_TeamSemiclip", ADMIN_CFG)
}
public ConsoleCommand_TeamSemiclip( id , level , cid )
{
if( cmd_access(id, level, cid, 2) )
{
new szArg[2]
read_argv(1, szArg, charsmax(szArg))
g_iTeamSemiclip = clamp(str_to_num(szArg), 0, 3)
}
return PLUGIN_HANDLED
}
public client_putinserver( id )
{
ClearUserAlive(id)
}
public client_disconnect( id )
{
ClearUserAlive(id)
}
public Ham_CBasePlayer_Spawn_Post( id )
{
if( is_user_alive(id) )
{
MarkUserAlive(id)
const XTRA_OFS_PLAYER = 5
const m_iTeam = 114
g_iTeam[id] = get_pdata_int(id, m_iTeam, XTRA_OFS_PLAYER)
}
else
{
ClearUserAlive(id)
}
}
public Ham_CBasePlayer_Killed_Post( id )
{
if( is_user_alive(id) )
{
MarkUserAlive(id)
}
else
{
ClearUserAlive(id)
}
}
public FM_client_AddToFullPack_Post(es, e, iEnt, id, hostflags, player, pSet)
{
if( player
&& id != iEnt
&& IsAlive(id)
&& g_iTeamSemiclip & g_iTeam[id]
&& IsAlive(iEnt)
&& g_iTeam[id] == g_iTeam[iEnt]
&& get_orig_retval() )
{
set_es(es, ES_Solid, SOLID_NOT)
set_es(es, ES_RenderMode, kRenderTransAlpha)
set_es(es, ES_RenderAmt, 250)
}
}
public Ham_CBasePlayer_PreThink_Post(id)
{
if( IsAlive(id) == 0 || !(g_iTeamSemiclip & g_iTeam[id]) )
{
return
}
new iPlayers[MAX_PLAYERS], iNum, iPlayer <---- Line 136
get_players(iPlayers, iNum, "ae", g_szTeams[g_iTeam[id]])
for(new i; i<iNum; i++)
{
iPlayer = iPlayers[i]
if( id != iPlayer )
{
entity_set_int(iPlayer, EV_INT_solid, SOLID_NOT)
}
}
}
public client_PostThink(id)
{
if( IsAlive(id) == 0 || !(g_iTeamSemiclip & g_iTeam[id]) )
{
return
}
new iPlayers[MAX_PLAYERS], iNum, iPlayer LINE <--- 156
get_players(iPlayers, iNum, "ae", g_szTeams[g_iTeam[id]])
for(new i; i<iNum; i++)
{
iPlayer = iPlayers[i]
if( id != iPlayer )
{
entity_set_int(iPlayer, EV_INT_solid, SOLID_SLIDEBOX)
}
}
}

BigMac
06-12-2010, 00:07
Heres the sma i think the lines got mess up when posting

fysiks
06-12-2010, 00:07
Are you going to answer my freaking question?

new iPlayers[MAX_PLAYERS], iNum, iPlayer <---- Line 136
new iPlayers[MAX_PLAYERS], iNum, iPlayer LINE <--- 156

Nope, not possible, try again.

BigMac
06-12-2010, 00:10
Yea i got the plugin from here

http://forums.alliedmods.net/showthread.php?t=69728&page=8


And sorry it was this line

get_players(iPlayers, iNum, "ae", g_szTeams[g_iTeam[id]]) <------- both of them

O and btw Thanks for the fast repiles Sorry my English isnt perfect

fysiks
06-12-2010, 00:22
Did you change something before these errors happened?

Why do you keep ignoring my question??????

You changed three things. Two of which should never be touched (g_szTeams, m_iTeam).

BigMac
06-12-2010, 00:27
Nothing i run it like it was before i change anything and still got them Now i just want to fix it

BigMac
06-12-2010, 00:29
Did you change something before these errors happened?

No, I just want to fix the errors cuz its filling my server up with error logs

fysiks
06-12-2010, 00:33
Then just re-download the plugin from that link you gave me.

BigMac
06-12-2010, 00:36
Dude my error log is 400.3 MBs of this error and i am using that one from the link right now and im still getting the same error Btw thanks for all the help i hope we can solve this

fysiks
06-12-2010, 00:43
Dude my error log is 400.3 MBs of this error and i am using that one from the link right now and im still getting the same error Btw thanks for all the help i hope we can solve this

What is confusing is that the code that you posted is NOT THE SAME code that is posted by Connor in the link you gave me.

BigMac
06-12-2010, 00:50
I am using this code

For team semiclip, try this :

Command : team_semiclip <0/1/2/3> 1:Ts , 2:CTs, 3:Both
Attached Fileshttp://forums.alliedmods.net/images/attach/sma.gifGet Plugin (http://www.amxmodx.org/plcompiler_vb.cgi?file_id=57954) or Get Source (http://forums.alliedmods.net/attachment.php?attachmentid=57954&d=1264142182) (team_semiclip.sma - 238 views - 3.6 KB)
Currently everything works But my errors logs get spammed with the errors i post to you and i am using this sorry i dont know how to quote a message from another link well Sorry for my bad English

BigMac
06-12-2010, 01:42
Ok i got it the error pops up only when your in spectator alive is there a problem with that ? could someone make it possible for it to work for spectators

fysiks
06-12-2010, 02:07
Only when your in spectator alive is there a problem with that ?

Yes. There is a problem with that.

BigMac
06-12-2010, 07:49
/* Formatright © 2009, ConnorMcLeod
Team SemiClip is free software;
you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Team SemiClip; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
new const VERSION[] = "0.0.2" // 22jan2010
const MAX_PLAYERS = 32
new g_bAlive
#define MarkUserAlive(%1) g_bAlive |= 1<<(%1 & 31)
#define ClearUserAlive(%1) g_bAlive &= ~( 1<<(%1 & 31) )
#define IsAlive(%1) g_bAlive & 1<<(%1 & 31)
new g_iTeam[MAX_PLAYERS+1]
new const g_szTeams[][] = {
"",
"TERRORIST",
"CT",
"SPECTATOR"
}
enum {
_T = 1,
_CT,
_SPEC
}
new g_iTeamSemiclip = _T | _CT | _SPEC
public plugin_init()
{
register_plugin("Team SemiClip", VERSION, "ConnorMcLeod")
RegisterHam(Ham_Spawn, "player", "Ham_CBasePlayer_Spawn_Post", 1)
RegisterHam(Ham_Killed, "player", "Ham_CBasePlayer_Killed_Post", 1)

register_forward(FM_AddToFullPack, "FM_client_AddToFullPack_Post", 1)
RegisterHam(Ham_Player_PreThink, "player", "Ham_CBasePlayer_PreThink_Post", 1)
register_concmd("team_semiclip", "ConsoleCommand_TeamSemiclip", ADMIN_CFG)
}
public ConsoleCommand_TeamSemiclip( id , level , cid )
{
if( cmd_access(id, level, cid, 2) )
{
new szArg[2]
read_argv(1, szArg, charsmax(szArg))
g_iTeamSemiclip = clamp(str_to_num(szArg), 0, 3)
}
return PLUGIN_HANDLED
}
public client_putinserver( id )
{
ClearUserAlive(id)
}
public client_disconnect( id )
{
ClearUserAlive(id)
}
public Ham_CBasePlayer_Spawn_Post( id )
{
if( is_user_alive(id) )
{
MarkUserAlive(id)
const XTRA_OFS_PLAYER = 5
const m_iTeam = 114
g_iTeam[id] = get_pdata_int(id, m_iTeam, XTRA_OFS_PLAYER)
}
else
{
ClearUserAlive(id)
}
}
public Ham_CBasePlayer_Killed_Post( id )
{
if( is_user_alive(id) )
{
MarkUserAlive(id)
}
else
{
ClearUserAlive(id)
}
}
public FM_client_AddToFullPack_Post(es, e, iEnt, id, hostflags, player, pSet)
{
if( player
&& id != iEnt
&& IsAlive(id)
&& g_iTeamSemiclip & g_iTeam[id]
&& IsAlive(iEnt)
&& g_iTeam[id] == g_iTeam[iEnt]
&& get_orig_retval() )
{
set_es(es, ES_Solid, SOLID_NOT)
static Float:flDistance
flDistance = entity_range(id, iEnt)
if( flDistance < 512.0 )
{
set_es(es, ES_RenderMode, kRenderTransAlpha)
set_es(es, ES_RenderAmt, 255)
}
}
}
public Ham_CBasePlayer_PreThink_Post(id)
{
if( IsAlive(id) == 0 || !(g_iTeamSemiclip & g_iTeam[id]) )
{
return
}
new iPlayers[MAX_PLAYERS], iNum, iPlayer
get_players(iPlayers, iNum, "ae", g_szTeams[g_iTeam[id]])
for(new i; i<iNum; i++)
{
iPlayer = iPlayers[i]
if( id != iPlayer )
{
entity_set_int(iPlayer, EV_INT_solid, SOLID_NOT)
}
}
}
public client_PostThink(id)
{
if( IsAlive(id) == 0 || !(g_iTeamSemiclip & g_iTeam[id]) )
{
return
}
new iPlayers[MAX_PLAYERS], iNum, iPlayer
get_players(iPlayers, iNum, "ae", g_szTeams[g_iTeam[id]])
for(new i; i<iNum; i++)
{
iPlayer = iPlayers[i]
if( id != iPlayer )
{
entity_set_int(iPlayer, EV_INT_solid, SOLID_SLIDEBOX)
}
}
}


I think i fix it Umm thanks for your Help Not sure on this part
+Krama for you

new const g_szTeams[][] = {
"", // do i need this to check for unasigned players?
"TERRORIST",
"CT",
"SPECTATOR"
}