Raised This Month: $ Target: $400
 0% 

[Solved] help ColorChat bug


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 10-05-2014 , 07:41   [Solved] help ColorChat bug
Reply With Quote #1

when message shows, its logging this error.

Start of error session.
L 10/05/2014 - 0338: Info (map "zm_fox") (file "addons/amxmodx/logs/error_20141005.log")
L 10/05/2014 - 0338: [AMXX] Displaying debug trace (plugin "zp_aps-Leader.amxx")
L 10/05/2014 - 0338: [AMXX] Run time error 4: index out of bounds
L 10/05/2014 - 0338: [AMXX] [0] ColorChat.inc::ColorChat (line 70)
L 10/05/2014 - 0338: [AMXX] [1] zp_aps-Leader.sma::Leader (line 137)

zp_aps_leader line 137 here

PHP Code:
public Leader()
{
    if ( 
get_pcvar_num(leader_msj) == || get_pcvar_num(leader_msj) == )
    {
        new 
iAmmoPacks
        
new iLeader GetLeader_Ammo(iAmmoPacks)
        new 
Players UsersGetPlaying()
        new 
iPlayers[32], iNumOthers
        
new szName[32]
        
get_user_nameiLeaderszName31 )
        
get_playersiPlayersiNum"ch" )
       
        if ( 
Players == )
            
ColorChat0GREEN"^x04[StreetZM]^x01 There are not players connected." )
        else if ( 
iAmmoPacks == Others )
            
ColorChat0GREEN"^x04[StreetZM]^x01 There is no leader." )
        else
            
ColorChat0GREY"^x04[StreetZM]^x01 The packs leader is^x03 %s^x01 @^x04 %d Packs."szNameiAmmoPacks )
    }
    
set_task(0.1"Leader_Frags")

ColorChat.INC here

PHP Code:
/* Fun functions
*
* by Numb
*
* This file is provided as is (no warranties).
*/


enum Color
{
    
NORMAL 1// clients scr_concolor cvar color
    
GREEN// Green Color
    
TEAM_COLOR// Red, grey, blue
    
GREY// grey
    
RED// Red
    
BLUE// Blue
}

new 
TeamName[][] = 
{
    
"",
    
"TERRORIST",
    
"CT",
    
"SPECTATOR"
}

ColorChat(idColor:type, const msg[], {Float,Sql,Result,_}:...)
{
    static 
message[256];

    switch(
type)
    {
        case 
NORMAL// clients scr_concolor cvar color
        
{
            
message[0] = 0x01;
        }
        case 
GREEN// Green
        
{
            
message[0] = 0x04;
        }
        default: 
// White, Red, Blue
        
{
            
message[0] = 0x03;
        }
    }

    
vformat(message[1], 251msg4);

    
// Make sure message is not longer than 192 character. Will crash the server.
    
message[192] = '^0';

    static 
teamColorChangeindexMSG_Type;
    
    if(
id)
    {
        
MSG_Type MSG_ONE;
        
index id;
    } else {
        
index FindPlayer();
        
MSG_Type MSG_ALL;
    }
    
    
team get_user_team(index);
    
ColorChange ColorSelection(indexMSG_Typetype);

    
ShowColorMessage(indexMSG_Typemessage);
        
    if(
ColorChange)
    {
        
Team_Info(indexMSG_TypeTeamName[team]);
    }
}

ShowColorMessage(idtypemessage[])
{
    
message_begin(typeget_user_msgid("SayText"), _id);
    
write_byte(id)        
    
write_string(message);
    
message_end();    
}

Team_Info(idtypeteam[])
{
    
message_begin(typeget_user_msgid("TeamInfo"), _id);
    
write_byte(id);
    
write_string(team);
    
message_end();

    return 
1;
}

ColorSelection(indextypeColor:Type)
{
    switch(
Type)
    {
        case 
RED:
        {
            return 
Team_Info(indextypeTeamName[1]);
        }
        case 
BLUE:
        {
            return 
Team_Info(indextypeTeamName[2]);
        }
        case 
GREY:
        {
            return 
Team_Info(indextypeTeamName[0]);
        }
    }

    return 
0;
}

FindPlayer()
{
    static 
i;
    
= -1;

    while(
<= get_maxplayers())
    {
        if(
is_user_connected(++i))
        {
            return 
i;
        }
    }

    return -
1;

__________________

Last edited by ghost95v; 10-05-2014 at 13:32.
ghost95v is offline
Send a message via Skype™ to ghost95v
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 10-05-2014 , 07:42   Re: [Req] help ColorChat bug
Reply With Quote #2

Which line exactly is line 137?
__________________
Kia is offline
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 10-05-2014 , 07:44   Re: [Req] help ColorChat bug
Reply With Quote #3

Quote:
Originally Posted by Kia View Post
Which line exactly is line 137?
PHP Code:
ColorChat0GREY"^x04[StreetZM]^x01 The packs leader is^x03 %s^x01 @^x04 %d Packs."szNameiAmmoPacks 
line 70 in colorchat.inc

PHP Code:
if(ColorChange)
    {
        
Team_Info(indexMSG_TypeTeamName[team]); 
exactly

PHP Code:
Team_Info(indexMSG_TypeTeamName[team]); 
__________________

Last edited by ghost95v; 10-05-2014 at 07:47.
ghost95v is offline
Send a message via Skype™ to ghost95v
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 10-05-2014 , 07:46   Re: [Req] help ColorChat bug
Reply With Quote #4

Try this
Code:
public Leader() {     if ( get_pcvar_num(leader_msj) == 1 || get_pcvar_num(leader_msj) == 3 )     {         new iLeader = GetLeader_Ammo(iAmmoPacks)         if(!is_user_connected(iLeader)) return PLUGIN_HANDLED                 new iAmmoPacks         new Players = UsersGetPlaying()         new iPlayers[32], iNum, Others         new szName[32]         get_user_name( iLeader, szName, 31 )         get_players( iPlayers, iNum, "ch" )                 if ( Players == 0 )             ColorChat( 0, GREEN, "^x04[StreetZM]^x01 There are not players connected." )         else if ( iAmmoPacks == Others )             ColorChat( 0, GREEN, "^x04[StreetZM]^x01 There is no leader." )         else             ColorChat( 0, GREY, "^x04[StreetZM]^x01 The packs leader is^x03 %s^x01 @^x04 %d Packs.", szName, iAmmoPacks )     }     set_task(0.1, "Leader_Frags") }
__________________
Kia is offline
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 10-05-2014 , 07:56   Re: [Req] help ColorChat bug
Reply With Quote #5

Quote:
Originally Posted by Kia View Post
Try this
Code:
public Leader() {     if ( get_pcvar_num(leader_msj) == 1 || get_pcvar_num(leader_msj) == 3 )     {         new iLeader = GetLeader_Ammo(iAmmoPacks)         if(!is_user_connected(iLeader)) return PLUGIN_HANDLED                 new iAmmoPacks         new Players = UsersGetPlaying()         new iPlayers[32], iNum, Others         new szName[32]         get_user_name( iLeader, szName, 31 )         get_players( iPlayers, iNum, "ch" )                 if ( Players == 0 )             ColorChat( 0, GREEN, "^x04[StreetZM]^x01 There are not players connected." )         else if ( iAmmoPacks == Others )             ColorChat( 0, GREEN, "^x04[StreetZM]^x01 There is no leader." )         else             ColorChat( 0, GREY, "^x04[StreetZM]^x01 The packs leader is^x03 %s^x01 @^x04 %d Packs.", szName, iAmmoPacks )     }     set_task(0.1, "Leader_Frags") }
you addet a check ? . im not sure its that problem . because without ColorChat , and with others chatcolors , its working good... and this happens to me and in other plugins when i put ColorChat
__________________

Last edited by ghost95v; 10-05-2014 at 08:01.
ghost95v is offline
Send a message via Skype™ to ghost95v
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 10-05-2014 , 09:11   Re: [Req] help ColorChat bug
Reply With Quote #6

Im not sure, i think the problem come from include

use ^4, ^3, ^1
no ^x01/3/4
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 10-05-2014 , 10:07   Re: [Req] help ColorChat bug
Reply With Quote #7

Just upload the full code here. ;)

I will try to help you.
zmd94 is offline
romi
Member
Join Date: Jul 2014
Location: Far Far AwaY From YoU!
Old 10-05-2014 , 11:15   Re: [Req] help ColorChat bug
Reply With Quote #8

Try this

PHP Code:
ColorChat(0GREY"^4[ZP]^1 The packs leader is^3 %s^1 @^4%s packs".xxx,xxx); 
romi is offline
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 10-05-2014 , 13:31   Re: [Req] help ColorChat bug
Reply With Quote #9

Quote:
Originally Posted by Fuck For Fun View Post
Im not sure, i think the problem come from include

use ^4, ^3, ^1
no ^x01/3/4
Solved, thnx all
__________________
ghost95v is offline
Send a message via Skype™ to ghost95v
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 02:41.


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