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

[ SOLVED ] [ Duplicate Say ]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Xablau
Member
Join Date: Dec 2014
Old 01-08-2015 , 05:24   [ SOLVED ] [ Duplicate Say ]
Reply With Quote #1

I have bug
Duplicate say on green chat

PHP Code:
public plugin_init() 
{
    
register_clcmd("say""handle_say")
}
public 
handle_say(id)
{
    new 
message[192]
    
read_args(message191)
    
remove_quotes(message)
    
    new 
name[32]
    
get_user_name(idname31)
    
    new 
alive is_user_alive(id)
    
    if(
alive)
        
format(message191"^x03%s^x01 : ^x04 %s"namemessage)
    else
        
format(message191"^x01*DEAD* ^x03%s^x01 : ^x04 %s"namemessage)
    
    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_CONTINUE


Last edited by Xablau; 01-08-2015 at 05:36. Reason: sorry for incorrect area
Xablau is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 01-08-2015 , 05:27   Re: [ Duplicate Say ]
Reply With Quote #2

Just try to add this code:
PHP Code:
public plugin_init()
{
    
// Other codes.
    
    
register_message(g_msgSayText"message_SayText")
}

public 
message_SayText(id)
{
    return 
PLUGIN_HANDLED

zmd94 is offline
Xablau
Member
Join Date: Dec 2014
Old 01-08-2015 , 05:30   Re: [ Duplicate Say ]
Reply With Quote #3

Tanks!

PHP Code:
new sayText

public plugin_init()  
{
    
sayText get_user_msgid ("SayText")
    
register_message (sayText"avoid_duplicated")
    
register_clcmd("say""handle_say"
}
public 
avoid_duplicated (msgIdmsgDestreceiver)
{
    return 
PLUGIN_HANDLED
}
public 
handle_say(id

    new 
message[192
    
read_args(message191
    
remove_quotes(message
     
    new 
name[32
    
get_user_name(idname31
     
    new 
alive is_user_alive(id
     
    if(
alive
        
format(message191"^x03%s^x01 : ^x04 %s"namemessage
    else 
        
format(message191"^x01*DEAD* ^x03%s^x01 : ^x04 %s"namemessage
     
    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_CONTINUE 


Last edited by Xablau; 01-08-2015 at 05:35. Reason: SOLVED
Xablau 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 17:00.


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