AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   colorchat problem (https://forums.alliedmods.net/showthread.php?t=132338)

seed 07-14-2010 08:32

colorchat problem
 
Hello, guys! I tried to make simple plugin, when a T/CT leaves, a red/blue message is shown on chat. Here's the code i tried:

Code:

blablabla
      ColorChat(0, TEAM_COLOR, "%s (%s) has left!", name, ip)
blablabla

But when me and a friend tested it a bug occured. My friend was T and when i (CT) left, the message was in red. When my friend left the message was in red, but he was T, so ok. But i want to fix this, so when a CT leaves, the message is in blue.



sorry, my english is not good :(

Alka 07-14-2010 08:38

Re: colorchat problem
 
If you put "TEAM_COLOR" will show the message color based on player team that read the message, so to T team will show RED and CT team BLUE. You must make something like

PHP Code:

    switch(get_user_team(id))
    {
        case 
1//T leave
        
{
            
ColorChat(0RED"^3%s (%s) has left!"nameip);
        }
        case 
2//CT leave
        
{
            
ColorChat(0BLUE"^3%s (%s) has left!"nameip);
        }
    } 

This is just an example and maybe you must modify it according to your defines / native.

seed 07-14-2010 09:45

Re: colorchat problem
 
Thanks for the answer! I have another question now: How can i make the message in 2 colors? I want nick and ip in red/blue/grey (depending ot team, i understood how to do this) and "has left!" in green.

EDIT: I found how to do this :)

I added some functions to my plugin and...argument type mismatch (argument 3) error + warning type mismatch. Here's s one of the messages that has this error:
Code:

case 1: ColorChat(0, RED, "^x03%s (%s) ^x04is trying to connect!", name, ip)

abdul-rehman 07-14-2010 09:53

Re: colorchat problem
 
Here as you wanted: [ has left is in green]
Code:
    switch(get_user_team(id))     {         case 1: //T leave         {             ColorChat(0, RED, "^3%s (%s) ^4has left!", name, ip);         }         case 2: //CT leave         {             ColorChat(0, BLUE, "^3%s (%s) ^4has left!", name, ip);         }     }

shuttle_wave 07-14-2010 09:53

Re: colorchat problem
 
PHP Code:

 ColorChat(0BLUE"^3%s ^x01(%s)^x04 has left!"nameip); 

thats an example

seed 07-14-2010 09:59

Re: colorchat problem
 
You're very fast guys! While i was editing my post, 2 new post appeared :D

I got argument type mismatch (argument 3) error + warning: tag mismatch
here's one ot the messages that has it:
Code:

case 1: ColorChat(0, RED, "^x03%s (%s) ^x04is trying to connect!", name, ip)
Yes, i added some other functions to this plugin. (trying to connect)


All times are GMT -4. The time now is 07:13.

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