AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   Solved [CS GO]Admin Chat doesn't display nickname (https://forums.alliedmods.net/showthread.php?t=341492)

Danielej1 01-26-2023 11:35

[CS GO]Admin Chat doesn't display nickname
 
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

alasfourom 01-28-2023 12:01

Re: [CS GO]Admin Chat doesn't display nickname
 
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;



Danielej1 01-28-2023 16:08

Re: [CS GO]Admin Chat doesn't display nickname
 
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

alasfourom 01-28-2023 19:20

Re: [CS GO]Admin Chat doesn't display nickname
 
Updated: Check last file down

Danielej1 01-29-2023 08:33

Re: [CS GO]Admin Chat doesn't display nickname
 
message doesn't show When he types in chat: #Hello

alasfourom 01-29-2023 08:56

Re: [CS GO]Admin Chat doesn't display nickname
 
Quote:

Originally Posted by Danielej1 (Post 2798234)
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); 

https://i.ibb.co/b1Pr16C/Picture1.png

Danielej1 01-29-2023 09:38

Re: [CS GO]Admin Chat doesn't display nickname
 
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

alasfourom 01-29-2023 09:54

Re: [CS GO]Admin Chat doesn't display nickname
 
sorry, I have no idea whats the exact issue, maybe other ppl can help you

Danielej1 01-29-2023 11:40

Re: [CS GO]Admin Chat doesn't display nickname
 
No problem, have you any plugin, which i can writing with only Admins on chat?

alasfourom 01-30-2023 11:44

Re: [CS GO]Admin Chat doesn't display nickname
 
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);
    }




All times are GMT -4. The time now is 03:23.

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