Raised This Month: $51 Target: $400
 12% 

[HELP] CS:GO >> Admin prefix + Colored name


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
viRR
Member
Join Date: Mar 2011
Location: Slovakia
Old 12-03-2012 , 20:19   [HELP] CS:GO >> Admin prefix + Colored name
Reply With Quote #1

Hey,
I have a problem, I do not understand what the problem is...
(I'm a newbie at scripting and I do not understand what the scipting is, either)

Code:
public OnPluginStart()
{
	CreateConVar("acc_version", VERSION, "");
		RegConsoleCmd("say", SayHook);
}


public Action:SayHook(client, Args)
{
	new AdminId:AdminID = GetUserAdmin(client);
	if(AdminID == INVALID_ADMIN_ID)
		return Plugin_Continue;
	
	decl String:Name[MAX_NAME_LENGTH];
	decl String:Msg[256];
		
	GetClientName(client, Name, sizeof(Name));
	GetCmdArgString(Msg, sizeof(Msg));
	Msg[strlen(Msg)-1] = '\0';
	CPrintToChatAll("[\x05Admin\x01] {teamcolor}%s: {default}%s", Name, Msg[1]);
	
	return Plugin_Handled;
}
If you guys help me or recommend another plugin resembling to this one, I'd be very happy.
Thanks.

Last edited by viRR; 12-03-2012 at 20:22.
viRR is offline
Send a message via Skype™ to viRR
InB
AlliedModders Donor
Join Date: Aug 2012
Location: Los Angeles
Old 12-03-2012 , 20:27   Re: [HELP] CS:GO >> Admin prefix + Colored name
Reply With Quote #2

IDK if it works with csgo, but this is what i use for css

PHP Code:
public OnPluginStart()
{
    
CreateConVar("acc_version"VERSION"");
    
AddCommandListener(SayHook"say");
}


public 
Action:SayHook(client, const String:command[], args)
{
    new 
AdminId:AdminID GetUserAdmin(client);
    if(
AdminID == INVALID_ADMIN_ID)
        return 
Plugin_Continue;
    
    
decl String:Name[MAX_NAME_LENGTH];
    
decl String:Msg[256];
        
    
GetClientName(clientNamesizeof(Name));
    
GetCmdArgString(Msgsizeof(Msg));
    
Msg[strlen(Msg)-1] = '\0';
    
CPrintToChatAll("[\x05Admin\x01] {teamcolor}%s: {default}%s"NameMsg[1]);
    
    return 
Plugin_Handled;

__________________

Last edited by InB; 12-03-2012 at 20:31.
InB is offline
viRR
Member
Join Date: Mar 2011
Location: Slovakia
Old 12-03-2012 , 20:32   Re: [HELP] CS:GO >> Admin prefix + Colored name
Reply With Quote #3

Everything works, except for the {teamcolor}
edit: But i've seen the {teamcolor} in a plugin for csgo and it worked

Attachments: In the picture, we can see 2 times used the {teamcolor} but the 1st time it is not working. (It is underlined)
Does anyone know how to fix it?
(btw i'm sorry for my english)
Attached Thumbnails
Click image for larger version

Name:	viRR.png
Views:	2101
Size:	62.2 KB
ID:	112826  

Last edited by viRR; 12-04-2012 at 14:14.
viRR is offline
Send a message via Skype™ to viRR
viRR
Member
Join Date: Mar 2011
Location: Slovakia
Old 12-04-2012 , 18:23   Re: [HELP] CS:GO >> Admin prefix + Colored name
Reply With Quote #4

A guy told me that it can be solved by phrases.
But I've never created a phrases.

adminprefix.smx
Code:
#include <sourcemod>
#include <colors>

public OnPluginStart()
{
    CreateConVar("acc_version", VERSION, "");
    AddCommandListener(SayHook, "say");
	LoadTranslations("adminprefix.phrases");
}


public Action:SayHook(client, const String:command[], args)
{
    new AdminId:AdminID = GetUserAdmin(client);
    if(AdminID == INVALID_ADMIN_ID)
        return Plugin_Continue;
    
    decl String:Name[MAX_NAME_LENGTH];
    decl String:Msg[256];
        
    GetClientName(client, Name, sizeof(Name));
    GetCmdArgString(Msg, sizeof(Msg));
    Msg[strlen(Msg)-1] = '\0';
    CPrintToChatAll("[\x05Admin\x01]%t %s: {default}%s", "ADMINPREFIX", Name, Msg[1]);
    
    return Plugin_Handled;
}
and adminprefix.phrases:

Code:
"Phrases"
{
	"ADMINPREFIX"
	{
		"#format"	"{1}"
		"en"		"{TEAMCOLOR}"
	}
}
Now what did I screw up? thx

Last edited by viRR; 12-04-2012 at 18:24.
viRR is offline
Send a message via Skype™ to viRR
minimoney1
SourceMod Donor
Join Date: Dec 2010
Old 12-04-2012 , 18:56   Re: [HELP] CS:GO >> Admin prefix + Colored name
Reply With Quote #5

Quote:
Originally Posted by viRR View Post
A guy told me that it can be solved by phrases.
But I've never created a phrases.

Now what did I screw up? thx
Use this:
PHP Code:
public OnPluginStart()
{
    
CreateConVar("acc_version"VERSION"");
    
AddCommandListener(SayHook"say");
}


public 
Action:SayHook(client, const String:command[], args)
{
    new 
AdminId:AdminID GetUserAdmin(client);
    if(
AdminID == INVALID_ADMIN_ID)
        return 
Plugin_Continue;
    
    
decl String:Name[MAX_NAME_LENGTH];
    
decl String:Msg[256];
        
    
GetClientName(clientNamesizeof(Name));
    
GetCmdArgString(Msgsizeof(Msg));
    
Msg[strlen(Msg)-1] = '\0';
    
CPrintToChatAllEx(client"[\x05Admin\x01] {teamcolor}%s: {default}%s"NameMsg[1]);
    
    return 
Plugin_Handled;


Last edited by minimoney1; 12-04-2012 at 18:56.
minimoney1 is offline
KyleS
SourceMod Plugin Approver
Join Date: Jul 2009
Location: Segmentation Fault.
Old 12-04-2012 , 21:48   Re: [HELP] CS:GO >> Admin prefix + Colored name
Reply With Quote #6

There's a %N format modifier that allows you to place the client index as an arg and pull the client's name.

PHP Code:
CPrintToChatAllEx(client"Hello %N!"client); 
If you're hooking say, you should probably check IsChatTrigger and check the player_say Event if you're rewriting chat.
KyleS is offline
Dragon4048
Member
Join Date: Mar 2007
Old 04-01-2013 , 16:44   Re: [HELP] CS:GO >> Admin prefix + Colored name
Reply With Quote #7

this script ist not working in csgo
Dragon4048 is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 04-01-2013 , 18:25   Re: [HELP] CS:GO >> Admin prefix + Colored name
Reply With Quote #8

Blocking 'say' and using CPrintToChatAll is very primitive and will cause issues with other plugins. Why not use pre-existing plugins, like Custom Chat Colors?

If you really want to write your own, at least use Simple Chat Processor (Redux) to intercept and rewrite chat.
__________________
Dr. McKay is offline
XpoHuk
Junior Member
Join Date: Apr 2013
Old 02-19-2015 , 11:39   Re: [HELP] CS:GO >> Admin prefix + Colored name
Reply With Quote #9

Tell me plz, where i can get that plugin (Admin prefix + Colored name) for CS:GO) , or it's private only?

Last edited by XpoHuk; 02-19-2015 at 11:40.
XpoHuk 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 21:23.


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