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

green admin chat v1.1


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Balgaa
Senior Member
Join Date: Mar 2010
Old 01-17-2015 , 22:41   green admin chat v1.1
Reply With Quote #1

Really, I need help to fix "index out of bounds". I askes from Exolent, no longer answer me...

Somebody help to fix this error?

root@cs:/home/csserver/serverfiles/cstrike/addons/amxmodx/logs# more error_20150111.log
L 01/11/2015 - 21:12:51: Start of error session.
L 01/11/2015 - 21:12:51: Info (map "de_dust2_a") (file "addons/amxmodx/logs/error_20150111.log")
L 01/11/2015 - 21:12:51: [AMXX] Displaying debug trace (plugin "green_admin_chat.amxx")
L 01/11/2015 - 21:12:51: [AMXX] Run time error 4: index out of bounds
L 01/11/2015 - 21:12:51: [AMXX] [0] green_admin_chat.sma::handle_teamsay (line 112)
Attached Files
File Type: sma Get Plugin or Get Source (green_admin_chat.sma - 575 views - 5.2 KB)
Balgaa is offline
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 01-18-2015 , 06:24   Re: green admin chat v1.1
Reply With Quote #2

Try this...


PHP Code:
#include <amxmodx>
#include <amxmisc>

#define ADMIN ADMIN_KICK    // Custom admin level

new gMaxPlayers
new gMsgSayText
new gTeams[3][] = 
    {
        
"Spectator",
        
"Terrorist",
        
"Counter-Terrorist"
    
}

public 
plugin_init()
{
    
register_plugin("Green Admin Chat""1.1""Arion")
    
register_clcmd("say""handle_say")
    
register_clcmd("say_team""handle_teamsay")
    
    
gMaxPlayers get_maxplayers()
    
gMsgSayText get_user_msgid("SayText")
}

public 
handle_say(id)
{
    new 
message[192]
    
read_args(message191)
    
remove_quotes(message)
    if(!
valid_message(message)) // Checks if message starts with / or @ or @@ or @@@
        
{
            return 
PLUGIN_CONTINUE
        
}
    
    new 
name[32]
    
get_user_name(idname31)
    
    new 
alive is_user_alive(id)

    new 
userFlags get_user_flags(id)
    
    if((
userFlags ADMIN) && aliveformat(message191"^x03%s ^x01: ^x04 %s"namemessage)               // Live admin
    
else if((userFlags ADMIN) && !aliveformat(message191"^x01*DEAD*^x03%s ^x01: ^x04 %s"namemessage)     // Dead admin
    
else if((!(userFlags ADMIN)) && aliveformat(message191"^x03%s ^x01:  %s"namemessage)              // Live normal player
    
else format(message191"^x01*DEAD*^x03%s ^x01:  %s"namemessage)                         // Dead normal player
    
    
for(new 1<= gMaxPlayersi++)
        {
            if(!
is_user_connected(i))
                continue
        
            if(
alive && is_user_alive(i) || !alive && !is_user_alive(i)) // Prints the message
                
{
                    
message_begin(MSG_ONEgMsgSayText, {000}, i)
                    
write_byte(id)
                    
write_string(message)
                    
message_end()
                }
        }
    return 
PLUGIN_HANDLED
}

public 
handle_teamsay(id)
{
    new 
message[192]
    
read_args(message191)
    
remove_quotes(message)
    
    if( !
is_user_connected(id) )
    {
        return 
PLUGIN_HANDLED_MAIN;
    }
    
    if(!
valid_message(message))
        {
            return 
PLUGIN_CONTINUE
        
}
        
    new 
name[32]
    
get_user_name(idname31)
    
    new 
alive is_user_alive(id)
    
    new 
team get_user_team(id)
    
    new 
userFlags get_user_flags(id)
    
    if((
userFlags ADMIN) && aliveformat(message191"^x01(%s)^x03 %s^x01 : ^x04 %s"gTeams[team], namemessage)
    else if((
userFlags ADMIN) && !aliveformat(message191"^x01*DEAD*(%s)^x03 %s^x01 : ^x04 %s"gTeams[team], namemessage)
    else if((!(
userFlags ADMIN)) && aliveformat(message191"^x01(%s)^x03 %s^x01 :  %s"gTeams[team], namemessage)
    else 
format(message191"^x01*DEAD*(%s)^x03 %s^x01 :  %s"gTeams[team], namemessage)
    
    for(new 
1<= gMaxPlayersi++)
        {
            if(!
is_user_connected(i))
                continue
        
            if(
get_user_team(i) != team)
                continue
        
            if(
alive && is_user_alive(i) || !alive && !is_user_alive(i))
                {
                    
message_begin(MSG_ONEgMsgSayText, {000}, i)
                    
write_byte(id)
                    
write_string(message)
                    
message_end()
                }
        }
    return 
PLUGIN_HANDLED
}

bool:valid_message(const message[])  // Returns False case message starts with / or @ or @@ or @@@, otherwise, returns True
{
    if(
message[0] == '/'
    
|| message[0] == '@'
    
|| message[0] == '@' && message[1] == '@'
    
|| message[0] == '@' && message[1] == '@' && message[2] == '@'
    
|| !strlen(message))
        {
            return 
false
        
}
    
    return 
true

__________________

Last edited by ghost95v; 01-18-2015 at 06:24.
ghost95v is offline
Send a message via Skype™ to ghost95v
Balgaa
Senior Member
Join Date: Mar 2010
Old 01-18-2015 , 07:04   Re: green admin chat v1.1
Reply With Quote #3

Let me try update you...

Thanks, no way to fix code?
Balgaa is offline
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 01-18-2015 , 07:06   Re: green admin chat v1.1
Reply With Quote #4

Quote:
Originally Posted by Balgaa View Post
Let me try update you...

Thanks, no way to fix code?
What ? ... i said Try it, and tell if you still get the error log.
__________________
ghost95v is offline
Send a message via Skype™ to ghost95v
Balgaa
Senior Member
Join Date: Mar 2010
Old 01-18-2015 , 07:08   Re: green admin chat v1.1
Reply With Quote #5

Sorry, thanks...

Get back to you...
Balgaa is offline
Balgaa
Senior Member
Join Date: Mar 2010
Old 01-21-2015 , 09:24   Re: green admin chat v1.1
Reply With Quote #6

Up to now for several days working fine, I will keep monitor it...

Thanks a lot
Balgaa is offline
Balgaa
Senior Member
Join Date: Mar 2010
Old 01-23-2015 , 10:55   Re: green admin chat v1.1
Reply With Quote #7

again i got error message

L 01/23/2015 - 22:22:02: Info (map "de_dust2_a") (file "addons/amxmodx/logs/error_20150123.log")
L 01/23/2015 - 22:22:02: [AMXX] Run time error 4 (plugin "green_admin_chat_arion.amxx") - debug not enabled!
L 01/23/2015 - 22:22:02: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 01/23/2015 - 22:22:23: [AMXX] Run time error 4 (plugin "green_admin_chat_arion.amxx") - debug not enabled!
L 01/23/2015 - 22:22:23: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
csserver@cs:~/serverfiles/cstrike/addons/amxmodx/logs$

i put debug option...will let you know when get debug information
Balgaa is offline
Balgaa
Senior Member
Join Date: Mar 2010
Old 01-24-2015 , 12:27   Re: green admin chat v1.1
Reply With Quote #8

this is error

L 01/24/2015 - 20:26:06: Start of error session.
L 01/24/2015 - 20:26:06: Info (map "awp_india") (file "addons/amxmodx/logs/error_20150124.log")
L 01/24/2015 - 20:26:06: [AMXX] Displaying debug trace (plugin "green_admin_chat_arion.amxx")
L 01/24/2015 - 20:26:06: [AMXX] Run time error 4: index out of bounds
L 01/24/2015 - 20:26:06: [AMXX] [0] green_admin_chat_arion.sma::handle_teamsay (line 89)
L 01/24/2015 - 20:27:14: [AMXX] Displaying debug trace (plugin "green_admin_chat_arion.amxx")
L 01/24/2015 - 20:27:14: [AMXX] Run time error 4: index out of bounds
L 01/24/2015 - 20:27:14: [AMXX] [0] green_admin_chat_arion.sma::handle_teamsay (line 89)
Balgaa 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:33.


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