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

Solved [CS GO]Admin Chat doesn't display nickname


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Danielej1
Senior Member
Join Date: Jul 2022
Location: Poland
Old 01-26-2023 , 11:35   [CS GO]Admin Chat doesn't display nickname
Reply With Quote #1

Hello i trying edit plugin Admin Chat because then plug doesn't display nick so The plugin uses the message as %s and I don't know how to do it because the username also uses %s, I don't know how I can explain it Sorry if anyone doesn't understand

Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR "Trum | Trum#7913"
#define PLUGIN_VERSION "1.00"

#include <sourcemod>
#include <sdktools>

#pragma newdecls required

public Plugin myinfo = {
    name = "[CSGO] Admin Talk",
    author = "Trum | Trum#7913",
    description = "Custom chat message for admins",
    url = "http://discord.me/trum",
};

public void OnPluginStart()
{
    RegAdminCmd("sm_at", Command_AdminMessage, ADMFLAG_SLAY, "The admin talk command");
}

public Action Command_AdminMessage(int client, int args)
{
char name[MAX_NAME_LENGTH];
GetClientName(client, name, sizeof(name));
	{
    if(args < 1)
		{
       	 PrintToConsole(client, "Usage: sm_at <message>");
       	 return Plugin_Handled;
		}
    char Message[32];
    
    GetCmdArgString(Message, sizeof(Message));
    PrintToChatAll (" \x07[ADMIN]\x10%s: \x09", Message);
    
    return Plugin_Handled;
	}
}
Orginal Plugin : https://forums.alliedmods.net/showthread.php?t=310137

Last edited by Danielej1; 01-30-2023 at 12:09.
Danielej1 is offline
alasfourom
Senior Member
Join Date: Feb 2022
Location: Saudi Arabia
Old 01-28-2023 , 12:01   Re: [CS GO]Admin Chat doesn't display nickname
Reply With Quote #2

PHP Code:
#include <sourcemod>
#pragma semicolon 1
#pragma newdecls required

public void OnPluginStart()
{
    
RegAdminCmd("sm_at"Command_AdminMessageADMFLAG_GENERIC"The admin talk command");
}

Action Command_AdminMessage(int clientint args)
{
    if(
args 1)
    {
        
ReplyToCommand(client"[SM] Usage: sm_at <message>");
        return 
Plugin_Handled;
    }
    
    
char sMessage[512];
    
GetCmdArgString(sMessagesizeof(sMessage));
    
    
PrintToChatAll ("\x07[ADMIN] \x10%N: \x09%s"clientsMessage);
    return 
Plugin_Handled;

__________________

Last edited by alasfourom; 01-28-2023 at 12:02.
alasfourom is offline
Danielej1
Senior Member
Join Date: Jul 2022
Location: Poland
Old 01-28-2023 , 16:08   Re: [CS GO]Admin Chat doesn't display nickname
Reply With Quote #3

Thanks for sending me the solution, it works but I still have a request because I want it to be a chat for admins only and not for everyone because now all players see these messages when they type on !sm_at
Danielej1 is offline
alasfourom
Senior Member
Join Date: Feb 2022
Location: Saudi Arabia
Old 01-28-2023 , 19:20   Re: [CS GO]Admin Chat doesn't display nickname
Reply With Quote #4

Updated: Check last file down
__________________

Last edited by alasfourom; 01-30-2023 at 17:12.
alasfourom is offline
Danielej1
Senior Member
Join Date: Jul 2022
Location: Poland
Old 01-29-2023 , 08:33   Re: [CS GO]Admin Chat doesn't display nickname
Reply With Quote #5

message doesn't show When he types in chat: #Hello
Danielej1 is offline
alasfourom
Senior Member
Join Date: Feb 2022
Location: Saudi Arabia
Old 01-29-2023 , 08:56   Re: [CS GO]Admin Chat doesn't display nickname
Reply With Quote #6

Quote:
Originally Posted by Danielej1 View Post
message doesn't show When he types in chat: #Hello
well, I just tested it, seems working fine

download the smx file and drop it, dont modify it, if still doesnt work, check your logs

** also try changing this line, dunno maybe ur game doesnt recognize these colors
PHP Code:
PrintToChat(i"\x03(Admin Chat) \x04%N\x01: \x05%s"clientsMessage); 
To
PHP Code:
PrintToChat(i"(Admin Chat) %N: %s"clientsMessage); 
__________________

Last edited by alasfourom; 01-29-2023 at 09:22.
alasfourom is offline
Danielej1
Senior Member
Join Date: Jul 2022
Location: Poland
Old 01-29-2023 , 09:38   Re: [CS GO]Admin Chat doesn't display nickname
Reply With Quote #7

it still doesn't work apparently I have some kind of error on the server or the plugin for CS:GO doesn't work but in console work plug

Last edited by Danielej1; 01-29-2023 at 09:41.
Danielej1 is offline
alasfourom
Senior Member
Join Date: Feb 2022
Location: Saudi Arabia
Old 01-29-2023 , 09:54   Re: [CS GO]Admin Chat doesn't display nickname
Reply With Quote #8

sorry, I have no idea whats the exact issue, maybe other ppl can help you
__________________
alasfourom is offline
Danielej1
Senior Member
Join Date: Jul 2022
Location: Poland
Old 01-29-2023 , 11:40   Re: [CS GO]Admin Chat doesn't display nickname
Reply With Quote #9

No problem, have you any plugin, which i can writing with only Admins on chat?
Danielej1 is offline
alasfourom
Senior Member
Join Date: Feb 2022
Location: Saudi Arabia
Old 01-30-2023 , 11:44   Re: [CS GO]Admin Chat doesn't display nickname
Reply With Quote #10

By using this character (#), you will able to access to admins private chat

Example: #Hello > (Admin Chat) Mario: Hello

PHP Code:
#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>

public Action OnClientSayCommand(int client, const char[] command, const char[] message)
{
    
int startidx;
    if (
message[startidx] != '#') return Plugin_Continue;
    
    
startidx++;
    if (
strcmp(command"say_team"false) == || strcmp(command"say"false) == 0)
    {
        if (
message[startidx] != '#')
        {
            if (!
CheckCommandAccess(client"sm_say"ADMFLAG_CHAT)) return Plugin_Continue;
            
PrintToAdmins(clientmessage[startidx]);
            return 
Plugin_Stop;
        }
        return 
Plugin_Stop;
    }
    return 
Plugin_Continue;
}

void PrintToAdmins(int client, const char[] sMessage)
{
    for(
int i 1<= MaxClientsi++)
    {
        if (!
IsClientInGame(i) || IsFakeClient(i) || !CheckCommandAccess(i"sm_say"ADMFLAG_CHAT)) continue;
        
PrintToChat(i"(Admin Chat) %N: %s"clientsMessage);
    }

__________________

Last edited by alasfourom; 01-30-2023 at 17:16.
alasfourom is offline
Reply


Thread Tools
Display Modes

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 09:09.


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