Raised This Month: $ Target: $400
 0% 

colorchat problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
seed
Junior Member
Join Date: Nov 2008
Location: Bulgaria !!!
Old 07-14-2010 , 08:32   colorchat problem
Reply With Quote #1

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
seed is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 07-14-2010 , 08:38   Re: colorchat problem
Reply With Quote #2

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.
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
seed
Junior Member
Join Date: Nov 2008
Location: Bulgaria !!!
Old 07-14-2010 , 09:45   Re: colorchat problem
Reply With Quote #3

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)

Last edited by seed; 07-14-2010 at 10:00.
seed is offline
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 07-14-2010 , 09:53   Re: colorchat problem
Reply With Quote #4

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);         }     }
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
shuttle_wave
Veteran Member
Join Date: Apr 2009
Location: New Zealand
Old 07-14-2010 , 09:53   Re: colorchat problem
Reply With Quote #5

PHP Code:
 ColorChat(0BLUE"^3%s ^x01(%s)^x04 has left!"nameip); 
thats an example
__________________
JailBreak Mod with Plugin API ( 90% ) Public
shuttle_wave is offline
seed
Junior Member
Join Date: Nov 2008
Location: Bulgaria !!!
Old 07-14-2010 , 09:59   Re: colorchat problem
Reply With Quote #6

You're very fast guys! While i was editing my post, 2 new post appeared

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)
seed 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 07:13.


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