Raised This Month: $32 Target: $400
 8% 

index out of bounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
khashayar007
Senior Member
Join Date: Jan 2015
Location: Macedonia
Old 11-19-2017 , 09:54   index out of bounds
Reply With Quote #1

Hi, can someone fix this error?


PHP Code:
L 11/17/2017 00:54:52: [AMXXDisplaying debug trace (plugin "adminhelp.amxx")
L 11/17/2017 00:54:52: [AMXXRun time error 4index out of bounds 
L 11
/17/2017 00:54:52: [AMXX]    [0colorchat.inc::ColorChat (line 70)
L 11/17/2017 00:54:52: [AMXX]    [1adminhelp.sma::dispInfo (line 79
Attached Files
File Type: sma Get Plugin or Get Source (adminhelp.sma - 286 views - 2.2 KB)
File Type: inc colorchat.inc (5.9 KB, 53 views)

Last edited by khashayar007; 11-19-2017 at 09:57.
khashayar007 is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 11-19-2017 , 11:03   Re: index out of bounds
Reply With Quote #2

may be syntax issue
79
PHP Code:
ColorChat(idGREY"%L"id"SERVER_INFO"); 
change to
PHP Code:
ColorChat(idGREY"%L"LANG_PLAYER"SERVER_INFO"); 
Bump
if its not above issue then i also want to know why its giving colorchat index out of bound
indraraj striker is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-19-2017 , 12:20   Re: index out of bounds
Reply With Quote #3

Quote:
Originally Posted by indraraj striker View Post
may be syntax issue
79
PHP Code:
ColorChat(idGREY"%L"id"SERVER_INFO"); 
change to
PHP Code:
ColorChat(idGREY"%L"LANG_PLAYER"SERVER_INFO"); 
Bump
if its not above issue then i also want to know why its giving colorchat index out of bound
You just made it incorrect. You don't use LANG_PLAYER when you send a message to a specific player.

The problem is in the colorchat.inc stock because there is no check whether the player is connected when sending a message to him. I assume the error is thrown when the server is empty and the plugin tries a send a global chat message. You can change to a better colorchat include (e.g.: https://forums.alliedmods.net/showthread.php?t=295046) or edit the colorchat.inc file which I wouldn't recommend since other people will have a different version of it.
__________________

Last edited by OciXCrom; 11-19-2017 at 12:21.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
khashayar007
Senior Member
Join Date: Jan 2015
Location: Macedonia
Old 11-19-2017 , 13:14   Re: index out of bounds
Reply With Quote #4

Can you replace it with your colorchat include?
khashayar007 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-19-2017 , 14:01   Re: index out of bounds
Reply With Quote #5

You can too. Simply replace #include <colorchat> with #include <cromchat> and remove the color agrument from the ColorChat function.

E.g.:

PHP Code:
ColorChat(idTEAM_COLOR"text"arg1arg2arg3
=>

PHP Code:
ColorChat(id"text"arg1arg2arg3
PS: mkd?
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 11-20-2017 , 00:20   Re: index out of bounds
Reply With Quote #6

Quote:
Originally Posted by OciXCrom View Post
You just made it incorrect. You don't use LANG_PLAYER when you send a message to a specific player.

The problem is in the colorchat.inc stock because there is no check whether the player is connected when sending a message to him. I assume the error is thrown when the server is empty and the plugin tries a send a global chat message. You can change to a better colorchat include (e.g.: https://forums.alliedmods.net/showthread.php?t=295046) or edit the colorchat.inc file which I wouldn't recommend since other people will have a different version of it.
Sorry, Thanks OciXCrom for correcting us
Because i too getting same error in one of my plugin only sometime
Can you tell me which part should i change in colorchat if not i will use your colorchat stock
i think colorchat stock is already checking is user connected or not
PHP Code:
if( id && !is_user_connected(id) )
    {
        return 
0;
    } 
Thanks a lot again

Last edited by indraraj striker; 11-20-2017 at 00:21.
indraraj striker is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-20-2017 , 07:38   Re: index out of bounds
Reply With Quote #7

The error happens when sending a message to all players in an empty server - ColorChat(0, COLOR, "message"), so I assume it's missing a check to see if there are players online when it sends a global message. I suggest you use my stock, because this is not the only problem you'll find. It's the same thing, just better coded.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 11-20-2017 , 07:40   Re: index out of bounds
Reply With Quote #8

Quote:
Originally Posted by OciXCrom View Post
The error happens when sending a message to all players in an empty server - ColorChat(0, COLOR, "message"), so I assume it's missing a check to see if there are players online when it sends a global message. I suggest you use my stock, because this is not the only problem you'll find. It's the same thing, just better coded.
Okay! OciXCrom
Thanks for reply
indraraj striker 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 23:20.


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