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

SourceMod Say Chat Color


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
rayanmadrid7
Junior Member
Join Date: Dec 2018
Location: Algeria
Old 12-11-2018 , 10:41   SourceMod Say Chat Color
Reply With Quote #1

hello Everybody, i have a little problem in source-mod cs:go scripting , i want to create a VIP Plugin which give you Armor,Grenades,Zombie Chicken Follow You , 16000$ Money , green Chat Color With Tag , HP , Weapons .

Armor,Grenades,zombie chicken,16000$,HP,Weapon Is Done
except the green chat color with tag , i have 2 problems

here is the script [hat's not complete script , it's only an example (a very little part of the script)]:
Code:
#include <sourcemod>
#include <colors>

public Plugin myinfo = 
{
name="Plugin test",
description = "plugin Test",
version = "1.0.0",
url = "https://forums.alliedmods.net",
author = "Test"
}

public void OnPluginStart(){
   RegConsoleCmd("say",SayVIP);
}

public Action:SayVIP(int client,char args){	
  decl String:Text[128];
  GetCmdArgString(Text,sizeof(Text));
  if(GetUserFlagBits(client) & ADMFLAG_CUSTOM1){
    if(IsPlayerAlive(client)){
      decl String:name[128];
      char BasicText[256];
      GetClientName(client,name,sizeof(name));
      Format(BasicText,sizeof(BasicText),"{green}[VIP] {teamcolor} %s{green}%s",name,Text);
      CPrintToChatAll(BasicText);
    }
    else{
      decl String:name[128];
      char BasicText[256];
      GetClientName(client,name,sizeof(name));
      Format(BasicText,sizeof(BasicText),"{default}[DEAD] {green}[VIP] {teamcolor}%s : {green}%s",name,Text);
      CPrintToChatAll(BasicText);
    }
  }
  else{
    if(IsPlayerAlive(client)){
       decl String:name[128];
       char BasicText[256];
       GetClientName(client,name,sizeof(name));
       Format(BasicText,sizeof(BasicText),"{teamcolo r}%s : {default}%s",name,Text);
       CPrintToChatAll(BasicText);
    }
    else{
      decl String:name[128];
      char BasicText[256];
      GetClientName(client,name,sizeof(name));
      Format(BasicText,sizeof(BasicText),"{default}[DEAD] {teamcolor}%s : {default}%s",name,Text);
      CPrintToChatAll(BasicText);
    }

  }

}
1 - the first problem is , when i execute the plugin and write something , it write it 2 times
2 - the second problem is , {teamcolor} color is not executing correctly , when i try it , it do a green color or an white color

PS : I have also tried AddCommandListener(SayVIP,"say") but same result

how to fix that?

Last edited by DarkDeviL; 12-11-2018 at 20:55. Reason: fixed formatting / code tag
rayanmadrid7 is offline
Indarello
Senior Member
Join Date: Nov 2015
Location: Russia
Old 12-11-2018 , 15:41   Re: SourceMod Say Chat Color
Reply With Quote #2

Use "code" in posting message so we can read your code
Code:
int a;
if (a)
{
    a = 10;
}

Last edited by Indarello; 12-11-2018 at 15:42.
Indarello is offline
rayanmadrid7
Junior Member
Join Date: Dec 2018
Location: Algeria
Old 12-11-2018 , 15:54   Re: SourceMod Say Chat Color
Reply With Quote #3

okey Indarello , i am new on this community and this forum , so i don't know every functionality of this site , anyway okey , now can you answer if you can ?
rayanmadrid7 is offline
impossible_cc
Senior Member
Join Date: Sep 2018
Location: Ukraine
Old 12-11-2018 , 17:01   Re: SourceMod Say Chat Color
Reply With Quote #4

Try this code

PHP Code:

public void OnPluginStart()
{
   
AddCommandListener(SayVIP"say");
 
AddCommandListener(SayVIP"say_team");
}


public 
Action SayVIP(int clientchar[] commandint args)
{    
  
decl String:Text[128];
  
GetCmdArgString(Text,sizeof(Text));
  
  
decl String:name[128];
  
GetClientName(client,name,sizeof(name));
  
  if(
GetUserFlagBits(client) & ADMFLAG_CUSTOM1)
  {
    if(
IsPlayerAlive(client))
    {
      
char BasicText[256];
      
Format(BasicText,sizeof(BasicText),"{green}[VIP] {teamcolor} %s{green}%s",name,Text);
      
CPrintToChatAll(BasicText);
    }
    else
    {
      
char BasicText[256];
      
Format(BasicText,sizeof(BasicText),"{default}[DEAD] {green}[VIP] {teamcolor}%s : {green}%s",name,Text);
      
CPrintToChatAll(BasicText);
    }
  }
  else
  {
    if(
IsPlayerAlive(client))
    {
       
char BasicText[256];
       
Format(BasicText,sizeof(BasicText),"{teamcolo r}%s : {default}%s",name,Text);
       
CPrintToChatAll(BasicText);
    }
    else
    {
      
char BasicText[256];
      
Format(BasicText,sizeof(BasicText),"{default}[DEAD] {teamcolor}%s : {default}%s",name,Text);
      
CPrintToChatAll(BasicText);
    }

  }
  return 
Plugin_Handled;


Last edited by impossible_cc; 12-11-2018 at 17:02.
impossible_cc is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 12-11-2018 , 21:05   Re: SourceMod Say Chat Color
Reply With Quote #5

Thread have been cleaned up a bit..

Quote:
Originally Posted by AlliedModders Rules
General:
If you post (or see a post) in the wrong section, use the Report Post button to request it be moved rather than replying to the thread.

Posting:
Always be respectful to other members. Flaming or abusing members in any way will not be tolerated.
Do not spam, or post "me too" posts, or any such derivative drivel that does not contribute to a thread.
Do not derail threads or post completely unrelated topics in a thread.
All of those rules, as well as the rest that haven't been mentioned here, applies to to all of you!

If you have no useful things to contribute with, then shut the fuck up.
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].

Last edited by DarkDeviL; 12-11-2018 at 21:05.
DarkDeviL is offline
rayanmadrid7
Junior Member
Join Date: Dec 2018
Location: Algeria
Old 12-12-2018 , 05:21   Re: SourceMod Say Chat Color
Reply With Quote #6

impossible_cc , i have mentioned i have already tried AddCommandListener , but the same result


and do you know why {teamcolor} is not executing correctly ?

Last edited by rayanmadrid7; 12-12-2018 at 05:23.
rayanmadrid7 is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 12-12-2018 , 09:57   Re: SourceMod Say Chat Color
Reply With Quote #7

Just an example.

PHP Code:

public Action OnClientSayCommand(int client, const char[] command, const char[] message)
{
    if (
client)
    {
        if(
GetUserFlagBits(client) & ADMFLAG_CUSTOM1)
        {
            
PrintToChatAll("%N : %s"clientmessage);
            return 
Plugin_Handled;
        }
    }
    
    return 
Plugin_Continue;

__________________
Ilusion9 is offline
rayanmadrid7
Junior Member
Join Date: Dec 2018
Location: Algeria
Old 12-12-2018 , 10:13   Re: SourceMod Say Chat Color
Reply With Quote #8

Ilusion9

1 - i'm using colors it mean CPrintChatAll
2- i have already mentioned i have used AddCommandListener but don't work
3 - i want to use colors not basic text so you must use format etc. , that's not something which help because i have already mentioned that type of things
rayanmadrid7 is offline
impossible_cc
Senior Member
Join Date: Sep 2018
Location: Ukraine
Old 12-12-2018 , 18:29   Re: SourceMod Say Chat Color
Reply With Quote #9

With addcommandlistener you can block original message if you return Plugin_Handled.
But I don't really know what is wrong with teamcolours.
impossible_cc is offline
rayanmadrid7
Junior Member
Join Date: Dec 2018
Location: Algeria
Old 12-14-2018 , 11:10   Re: SourceMod Say Chat Color
Reply With Quote #10

impossible_cc , thank you it work , now can anyone find the problem with {teamcolor} ?
rayanmadrid7 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 05:14.


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