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

Say / Say_Team


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dr7sTyLe
Senior Member
Join Date: Dec 2010
Old 07-26-2011 , 09:35   Say / Say_Team
Reply With Quote #1

I tried making the message that player writes with the colors and stuff as i like:
PHP Code:
#include <amxmodx>
#include <colorchat>

public plugin_init()
{
    
register_clcmd("say","handle_say")
    
register_clcmd("say_team","handle_sayteam")
}
public 
handle_say(id)
{
    new 
szArg[192]
    new 
name[32]
    
read_args(szArg,charsmax(szArg))
    
get_user_name(id,name,31)
    
remove_quotes(szArg)
    
ColorChat(0,RED,"%s^x04 :^x01 %s.",name,szArg)
}
public 
handle_sayteam(id)
{
    new 
szArg[192]
    
read_args(szArg,charsmax(szArg))
    
remove_quotes(szArg)
    if(
get_user_team(id) == 1)
    {
        new 
players[32], pnumtempid
        new 
szName[32], szTempid[10]; 
        
get_user_name(id,szName,31)
        
get_players(playerspnum"a"); 
        for( new 
ii<pnumi++ ) 
        { 
            
tempid players[i];
            
get_user_name(tempidszName31); 
            
num_to_str(tempidszTempid9);
        } 
        
ColorChat(tempid,RED,"[^x04 Team^x03 ]^x01 %s^x04 :^x01 %s.",szName,szArg)
    }
    if(
get_user_team(id) == 2)
    {
        new 
players[32], pnumtempid
        new 
szName[32], szTempid[10]; 
        
get_user_name(id,szName,31)
        
get_players(playerspnum"a"); 
        for( new 
ii<pnumi++ ) 
        { 
            
tempid players[i];
            
get_user_name(tempidszName31); 
            
num_to_str(tempidszTempid9);
        } 
        
ColorChat(tempid,BLUE,"[^x04 Team^x03 ]^x01 %s^x04 :^x01 %s.",szName,szArg)
    }

but im having problem with the say_team i want it to show the message only for the users team.
Dr7sTyLe is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 07-26-2011 , 09:50   Re: Say / Say_Team
Reply With Quote #2

check first in which team your user is ( writer ).
exaple :
PHP Code:
if(get_user_team(id) == 1)
{
while....
if(
get_user_team(tempid) == 1)
{
//show the msg

Ps. i would use switches...
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
r0ck
Senior Member
Join Date: Jun 2011
Location: India
Old 07-26-2011 , 09:50   Re: Say / Say_Team
Reply With Quote #3

TRY THIS ?
PHP Code:

#include <amxmodx> 
#include <colorchat> 

public plugin_init() 

    
register_clcmd("say","handle_say"
    
register_clcmd("say_team","handle_sayteam"

public 
handle_say(id

    new 
szArg[192
    new 
name[32
    
read_args(szArg,charsmax(szArg)) 
    
get_user_name(id,name,31
    
remove_quotes(szArg
    
ColorChat(0,RED,"%s^x04 :^x01 %s.",name,szArg

public 
handle_sayteam(id

    new 
szArg[192
    
read_args(szArg,charsmax(szArg)) 
    
remove_quotes(szArg
    if(
get_user_team(id) == 1
    { 
        new 
players[32], pnumtempid;  
        new 
szName[32], szTempid[10];  
        
get_user_name(id,szName,31
        
get_players(playerspnum"ae""TERRORIST");  
        for( new 
ii<pnumi++ )  
        {  
            
tempid players[i]; 
            
get_user_name(tempidszName31);  
            
num_to_str(tempidszTempid9); 
        }  
        
ColorChat(tempid,RED,"[^x04 Team^x03 ]^x01 %s^x04 :^x01 %s.",szName,szArg
    } 
    if(
get_user_team(id) == 2
    { 
        new 
players[32], pnumtempid;  
        new 
szName[32], szTempid[10];  
        
get_user_name(id,szName,31
        
get_players(playerspnum"ae""CT");  
        for( new 
ii<pnumi++ )  
        {  
            
tempid players[i]; 
            
get_user_name(tempidszName31);  
            
num_to_str(tempidszTempid9); 
        }  
        
ColorChat(tempid,BLUE,"[^x04 Team^x03 ]^x01 %s^x04 :^x01 %s.",szName,szArg
    } 

__________________
Preparing to release my plugins..
r0ck is offline
Dr7sTyLe
Senior Member
Join Date: Dec 2010
Old 07-26-2011 , 09:56   Re: Say / Say_Team
Reply With Quote #4

Quote:
Originally Posted by r0ck View Post
TRY THIS ?
PHP Code:

#include <amxmodx> 
#include <colorchat> 

public plugin_init() 

    
register_clcmd("say","handle_say"
    
register_clcmd("say_team","handle_sayteam"

public 
handle_say(id

    new 
szArg[192
    new 
name[32
    
read_args(szArg,charsmax(szArg)) 
    
get_user_name(id,name,31
    
remove_quotes(szArg
    
ColorChat(0,RED,"%s^x04 :^x01 %s.",name,szArg

public 
handle_sayteam(id

    new 
szArg[192
    
read_args(szArg,charsmax(szArg)) 
    
remove_quotes(szArg
    if(
get_user_team(id) == 1
    { 
        new 
players[32], pnumtempid;  
        new 
szName[32], szTempid[10];  
        
get_user_name(id,szName,31
        
get_players(playerspnum"ae""TERRORIST");  
        for( new 
ii<pnumi++ )  
        {  
            
tempid players[i]; 
            
get_user_name(tempidszName31);  
            
num_to_str(tempidszTempid9); 
        }  
        
ColorChat(tempid,RED,"[^x04 Team^x03 ]^x01 %s^x04 :^x01 %s.",szName,szArg
    } 
    if(
get_user_team(id) == 2
    { 
        new 
players[32], pnumtempid;  
        new 
szName[32], szTempid[10];  
        
get_user_name(id,szName,31
        
get_players(playerspnum"ae""CT");  
        for( new 
ii<pnumi++ )  
        {  
            
tempid players[i]; 
            
get_user_name(tempidszName31);  
            
num_to_str(tempidszTempid9); 
        }  
        
ColorChat(tempid,BLUE,"[^x04 Team^x03 ]^x01 %s^x04 :^x01 %s.",szName,szArg
    } 

k i will try it later.
but it wont show the users normal message without the colors right ?
Dr7sTyLe is offline
Dr7sTyLe
Senior Member
Join Date: Dec 2010
Old 07-26-2011 , 13:55   Re: Say / Say_Team
Reply With Quote #5

Quote:
Originally Posted by Dr7sTyLe View Post
k i will try it later.
but it wont show the users normal message without the colors right ?
Help Me Please It Shows Both The Normal message ani my plugins message help pls ?
Dr7sTyLe is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 07-26-2011 , 14:15   Re: Say / Say_Team
Reply With Quote #6

you have to return the normal msg
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Dr7sTyLe
Senior Member
Join Date: Dec 2010
Old 07-26-2011 , 14:53   Re: Say / Say_Team
Reply With Quote #7

Quote:
Originally Posted by One View Post
you have to return the normal msg
i know i already fixed that but another problem.
if i write something in say_team im the only person who see it -_-
Dr7sTyLe is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-26-2011 , 16:08   Re: Say / Say_Team
Reply With Quote #8

Probably because you copied code from a menu.
All of your color chats are not in any loop.

PHP Code:
loop through players
    
if player has the same team as "id"
        
show the message
endloop 
__________________
fysiks is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 07-26-2011 , 16:35   Re: Say / Say_Team
Reply With Quote #9

or :

PHP Code:
function ()
{
    
check users team
    
    
switch teams
    
{
        case 
team T =
        
make a loop between all users in the same team
        
{
            
show the message to the users  and return the standard msg
        
}
        
        case 
team CT =
        
make a loop between all users in the same team TEAM 2 )
        {
            
show the message and return the standard msg
        
}
    }

__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Dr7sTyLe
Senior Member
Join Date: Dec 2010
Old 07-27-2011 , 02:52   Re: Say / Say_Team
Reply With Quote #10

Quote:
Originally Posted by fysiks View Post
Probably because you copied code from a menu.
All of your color chats are not in any loop.

PHP Code:
loop through players
    
if player has the same team as "id"
        
show the message
endloop 
Quote:
Originally Posted by One View Post
or :

PHP Code:
function ()
{
    
check users team
    
    
switch teams
    
{
        case 
team T =
        
make a loop between all users in the same team
        
{
            
show the message to the users  and return the standard msg
        
}
        
        case 
team CT =
        
make a loop between all users in the same team TEAM 2 )
        {
            
show the message and return the standard msg
        
}
    }

Yeah thank you both,but someoone already explained me what was wrong :]
Dr7sTyLe 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 01:07.


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