AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   SourceMod Say Chat Color (https://forums.alliedmods.net/showthread.php?t=312676)

rayanmadrid7 12-11-2018 10:41

SourceMod Say Chat Color
 
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?

Indarello 12-11-2018 15:41

Re: SourceMod Say Chat Color
 
Use "code" in posting message so we can read your code
Code:

int a;
if (a)
{
    a = 10;
}


rayanmadrid7 12-11-2018 15:54

Re: SourceMod Say Chat Color
 
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 ?

impossible_cc 12-11-2018 17:01

Re: SourceMod Say Chat Color
 
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;



DarkDeviL 12-11-2018 21:05

Re: SourceMod Say Chat Color
 
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.

rayanmadrid7 12-12-2018 05:21

Re: SourceMod Say Chat Color
 
impossible_cc , i have mentioned i have already tried AddCommandListener , but the same result
:nono::nono:

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

Ilusion9 12-12-2018 09:57

Re: SourceMod Say Chat Color
 
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;



rayanmadrid7 12-12-2018 10:13

Re: SourceMod Say Chat Color
 
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

impossible_cc 12-12-2018 18:29

Re: SourceMod Say Chat Color
 
With addcommandlistener you can block original message if you return Plugin_Handled.
But I don't really know what is wrong with teamcolours.

rayanmadrid7 12-14-2018 11:10

Re: SourceMod Say Chat Color
 
impossible_cc , thank you it work , now can anyone find the problem with {teamcolor} ?


All times are GMT -4. The time now is 16:54.

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