Raised This Month: $12 Target: $400
 3% 

[miscstats.sma] Run time error 4, on line 318


  
 
 
Thread Tools Display Modes
Author Message
vittu
SuperHero Moderator
Join Date: Oct 2004
Location: L.A. County, CA
Old 10-24-2006 , 06:12   [miscstats.sma] Run time error 4, on line 318
#1

server: Windows 2003
mod: CS
amxmodx ver: 1.76a

Code:
L 10/23/2006 - 22:12:43: [AMXX] Displaying debug trace (plugin "miscstats.amxx")
L 10/23/2006 - 22:12:43: [AMXX] Run time error 4: index out of bounds 
L 10/23/2006 - 22:12:43: [AMXX]    [0] miscstats.sma::client_death (line 318)

need anything else?
vittu is offline
Send a message via AIM to vittu Send a message via MSN to vittu Send a message via Yahoo to vittu
KWo
AMX Mod X Beta Tester
Join Date: Jul 2004
Location: Poland
Old 10-24-2006 , 11:33   Re: [miscstats.sma] Run time error 4, on line 318
#2

Code:
    if (EnemyRemaining)     {         new ppl[32], pplnum = 0         new team = get_user_team(victim) - 1                 if (team >= 0 && team < 4) // problem here             get_players(ppl, pplnum, "e", g_teamsNames[1 - team]) // line 318                 if (pplnum)         {             new eppl[32], epplnum                         if (team >= 0 && team < 4) // possibility of the problem here             {                 get_players(eppl, epplnum, "ae", g_teamsNames[team]) // this may generate problems, too
it would be better if You have there (in both cases):
Code:
    if (EnemyRemaining)     {         new ppl[32], pplnum = 0         new team = get_user_team(victim) - 1                 if (team >= 0 && team < 2) // now only 0 and 1 possible             get_players(ppl, pplnum, "e", g_teamsNames[1 - team])                 if (pplnum)         {             new eppl[32], epplnum                         if (team >= 0 && team < 2) // same as above             {                 get_players(eppl, epplnum, "ae", g_teamsNames[team])
__________________
The Fullpack of podbot mm V3B22 - 24 apr 2012!!! is available here.
The All-In-One 3.2a package - 02 jun 2013 (AMX X 1.8.2 [with ATAC 3.0.1b , CSDM2.1.3c beta, CM OE 0.6.5, podbot mm V3B22c and mm 1.20) is available here.
The newest Beta V3B23a (rel. 28 august 2018!!!) is available here.
KWo is offline
BAILOPAN
Join Date: Jan 2004
Old 10-24-2006 , 13:11   Re: [miscstats.sma] Run time error 4, on line 318
#3

I'll bite. This code is pretty horrible. I've rewritten that block as revision 3128, for two reasons: remove a lot of redundancy/unused data and to get rid of using get_players "e," which is not supported.

More curious is why get_user_team would return an invalid number there, but I've opted for more concrete error checking and using cs_get_user_team.

I've attached a binary below in case you want to try it.
Attached Files
File Type: amxx miscstats.amxx (21.7 KB, 470 views)
__________________
egg
BAILOPAN is offline
KWo
AMX Mod X Beta Tester
Join Date: Jul 2004
Location: Poland
Old 10-25-2006 , 02:55   Re: [miscstats.sma] Run time error 4, on line 318
#4

Quote:
Originally Posted by BAILOPAN
and to get rid of using get_players "e," which is not supported.
Since which AMX X version? Here is what I can see in include from 1.76a:

Quote:
Originally Posted by amxmodx.inc
/* Sets indexes of players.
* Flags:
* "a" - don't collect dead players.
* "b" - don't collect alive players.
* "c" - skip bots.
* "d" - skip real players.
* "e" - match with team.
* "f" - match with part of name.
* "g" - ignore case sensitivity.
* "h" - skip HLTV.
* Example: Get all alive CTs: get_players(players,num,"ae","CT") */
native get_players(players[32], &num ,const flags[]="", const team[]="");
__________________
The Fullpack of podbot mm V3B22 - 24 apr 2012!!! is available here.
The All-In-One 3.2a package - 02 jun 2013 (AMX X 1.8.2 [with ATAC 3.0.1b , CSDM2.1.3c beta, CM OE 0.6.5, podbot mm V3B22c and mm 1.20) is available here.
The newest Beta V3B23a (rel. 28 august 2018!!!) is available here.
KWo is offline
vittu
SuperHero Moderator
Join Date: Oct 2004
Location: L.A. County, CA
Old 10-25-2006 , 04:21   Re: [miscstats.sma] Run time error 4, on line 318
#5

After using revision 3128:
Code:
L 10/25/2006 - 00:41:42: [CSTRIKE] Invalid player 13
L 10/25/2006 - 00:41:42: [AMXX] Displaying debug trace (plugin "miscstats.amxx")
L 10/25/2006 - 00:41:42: [AMXX] Run time error 10: native error (native "cs_get_user_team")
L 10/25/2006 - 00:41:42: [AMXX]    [0] miscstats.sma::client_death (line 329)
Somethings not right here. My best guess is something from an afk slay/kick plugin that the server recently added is causing this issue with miscstats, I will report back when I have more infromation about that.
vittu is offline
Send a message via AIM to vittu Send a message via MSN to vittu Send a message via Yahoo to vittu
BAILOPAN
Join Date: Jan 2004
Old 10-25-2006 , 12:58   Re: [miscstats.sma] Run time error 4, on line 318
#6

Okay.
__________________
egg
BAILOPAN is offline
organizedKaoS
Senior Member
Join Date: Feb 2006
Old 10-25-2006 , 14:21   Re: [miscstats.sma] Run time error 4, on line 318
#7

Here's the code from my edited version of miscstats, last man section.

I edited it because it was returning server as the player name if it was a bot and human as last two remaining players. Maybe this format can help...IDK.

Code:
if (LastMan)         {         new tnum, ctnum         for (new i=0;i<=g_maxplayers;i++)//g_maxplayers = get_maxplayers()             {             if (!is_user_alive(i))                 continue                         new team = get_user_team(i)                         switch(team)             {                 case 1: tnum++ //T                 case 2: ctnum++ //CT             }         }           if (tnum == 1 && ctnum == 1)//Check if t and ct have 1 player left             {             new Players[32], alive, ateam             new playerCount             new ctname[32], tname[32]             get_players(Players, playerCount, "a")             for (new i=0;i<playerCount;i++)                 {                 alive = Players[i]                                 ateam = get_user_team(alive)                                 switch(ateam)                 {                     case 1: get_user_name(alive, tname, 31)                     case 2: get_user_name(alive, ctname, 31)                 }                               set_hudmessage(0, 255, 255, 0.33, 0.55, 0, 6.0, 6.0, 0.5, 0.15, -1)                 ShowSyncHudMsg(0, g_bottom_sync, "%s vs. %s", ctname, tname)                                 play_sound("showdown/showdown2")             }         }     } }
organizedKaoS is offline
BAILOPAN
Join Date: Jan 2004
Old 10-27-2006 , 01:35   Re: [miscstats.sma] Run time error 4, on line 318
#8

organizedKaos: Thanks for the code ;) There is one small bug: i should start as 1, not 0.
vittu: This was my own stupid bug. Please try revision 3134 which checks player validity.
__________________
egg

Last edited by BAILOPAN; 10-27-2006 at 01:41.
BAILOPAN is offline
organizedKaoS
Senior Member
Join Date: Feb 2006
Old 10-27-2006 , 01:46   Re: [miscstats.sma] Run time error 4, on line 318
#9

Thanks for the headsup.

I'll implement this change to my miscstats...though I have not had any problems with it starting as 0....oh well
organizedKaoS is offline
BAILOPAN
Join Date: Jan 2004
Old 10-27-2006 , 01:48   Re: [miscstats.sma] Run time error 4, on line 318
#10

Probably because id 0 is never "alive" (it's world).
__________________
egg
BAILOPAN is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:35.


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