Raised This Month: $ Target: $400
 0% 

Run time error 4: Index out of bounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NiQu
Veteran Member
Join Date: Nov 2009
Old 03-08-2010 , 12:55   Run time error 4: Index out of bounds
Reply With Quote #1

I got that thing in my server console...

Line's it gives this on is 540 and 2659:
FIXED! For others with this problem: Check if users are connected!

l540:
PHP Code:
F_Print(id"You got 10 dollars!"); //Line 540 
Function #1
PHP Code:
F_Print(id, const sMsg[], any:...)
{
    static 
iid id get_Player();
    if ( !
) return;
    
    new 
sMessage[256];
    new 
len formatex(sMessagesizeof(sMessage) - 1"^x04[%s %s]^x03 "PLUGIN_PREFIXVERSION);
    
vformat(sMessage[len], sizeof(sMessage) - lensMsg3);
    
sMessage[192] = '^0';
    
    static 
msgid_SayText;
    if ( !
msgid_SayText msgid_SayText get_user_msgid("SayText");
    
    new const 
team_Names[][] =
    {
        
"",
        
"TERRORIST",
        
"CT",
        
"SPECTATOR"
    
};
    
    new 
sTeam get_user_team(i);
    
    
team_Info(iidteam_Names[0]);
    
    
message_begin(id MSG_ONE_UNRELIABLE MSG_BROADCASTmsgid_SayText_id);
    
write_byte(i);
    
write_string(sMessage);
    
message_end();
    
    
team_Info(iidteam_Names[sTeam]); //Line 2659!

Function #2:
PHP Code:
team_Info(receiversendersTeam[])
{
    static 
msgid_TeamInfo;
    if ( !
msgid_TeamInfo msgid_TeamInfo get_user_msgid("TeamInfo");
    
    
message_begin(sender MSG_ONE_UNRELIABLE MSG_BROADCASTmsgid_TeamInfo_sender);
    
write_byte(receiver);
    
write_string(sTeam);
    
message_end();

Function #3:
PHP Code:
get_Player()
{
    for ( new 
id 1id <= gMaxPlayersid++ )
    {
        if ( 
gbConnected[id] )
        {
            return 
id;
        }
    }
    
    return 
0;

Please help , what can the problem be ?
__________________
My Projects
  • RoTAPI V0.0.1 ------- Private
    • Progress - [||||||||||]
  • CashMod V0.0.6 ----- Public
    • Progress - [||||||||||]
  • CashMod V0.0.7 ----- Public
    • Progress - [||||||||||]

Last edited by NiQu; 03-09-2010 at 04:19.
NiQu is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-08-2010 , 13:42   Re: Run time error 4: Index out of bounds
Reply With Quote #2

show where gbConnected is defined
__________________
Bugsy is offline
NiQu
Veteran Member
Join Date: Nov 2009
Old 03-08-2010 , 14:03   Re: Run time error 4: Index out of bounds
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
show where gbConnected is defined
PHP Code:
new bool:gbConnected[33]; 
Its above plugin_init and everything.
__________________
My Projects
  • RoTAPI V0.0.1 ------- Private
    • Progress - [||||||||||]
  • CashMod V0.0.6 ----- Public
    • Progress - [||||||||||]
  • CashMod V0.0.7 ----- Public
    • Progress - [||||||||||]
NiQu is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-08-2010 , 16:28   Re: Run time error 4: Index out of bounds
Reply With Quote #4

Try using cs_get_user_team().
__________________
Bugsy is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 03-08-2010 , 16:32   Re: Run time error 4: Index out of bounds
Reply With Quote #5

What's line 2659?

Also, post the full function that the incorrect F_Print is in, please.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-08-2010 , 16:34   Re: Run time error 4: Index out of bounds
Reply With Quote #6

Im on my phone now so cant take a good look. You can post or pm your full code if you cant figure it out.

Wrecked, see function #1, theres a comment after the line.
__________________

Last edited by Bugsy; 03-08-2010 at 16:36.
Bugsy is offline
NiQu
Veteran Member
Join Date: Nov 2009
Old 03-08-2010 , 17:33   Re: Run time error 4: Index out of bounds
Reply With Quote #7

wrecked_ i did, look in the first post.. all functions is in there.

and Bugsy is right.
__________________
My Projects
  • RoTAPI V0.0.1 ------- Private
    • Progress - [||||||||||]
  • CashMod V0.0.6 ----- Public
    • Progress - [||||||||||]
  • CashMod V0.0.7 ----- Public
    • Progress - [||||||||||]
NiQu is offline
Reply



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 08:36.


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