Raised This Month: $ Target: $400
 0% 

adminchat modification [SOLVED]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ehha
SourceMod Donor
Join Date: Apr 2006
Location: Sibiu
Old 03-18-2009 , 16:28   adminchat modification [SOLVED]
Reply With Quote #1

I wanted to modify admin chat to display a amx_chat message if you type @message in say if you have ADMIN_CHAT flag or just @message in normal say chat if yo don't.

Code:
public plugin_init() {     register_clcmd("say", "chat123", ADMIN_ALL, "@stuff") } public chat123(id, level, cid) {     if(get_user_flags(id) & ADMIN_CHAT)         return PLUGIN_CONTINUE     new said[2]     read_argv(1, said, 1)         if (said[0] != '@')         return PLUGIN_CONTINUE         new message[192], name[32], players[32], inum, authid[32], userid         read_args(message, 191)     remove_quotes(message)     get_user_authid(id, authid, 31)     get_user_name(id, name, 31)     userid = get_user_userid(id)     get_players(players, inum)         log_amx("Chat: ^"%s<%d><%s><>^" chat ^"%s^"", name, userid, authid, message)     log_message("^"%s<%d><%s><>^" triggered ^"admin_chat^" (text ^"%s^")", name, userid, authid, message)         format(message, 191, "(Admin Chat) %s :   %s", name, message[1])     console_print(id, "%s", message)         for (new i = 0; i < inum; ++i)     {         if (access(players[i], ADMIN_CHAT))             client_print(players[i], print_chat, "%s", message)     }         return PLUGIN_HANDLED }

It works when i have the chat flag but wen i don't it doesn't display anything and i get this in the server's console:
Code:
L 03/18/2009 - 22:02:39: [adminchat.amxx] Chat: "player<5><STEAM_0:1:8796278><>" chat "@test 123"
L 03/18/2009 - 22:02:39: "player<5><STEAM_0:1:8796278><>" triggered "amx_chat" (text "@test 123")
One more thing, after reading the info from the return constants i still don't know how to use the correctly. Can someone explain and perhaps give me 3 examples for PLUGIN_CONTINUE, PLUGIN_HANDLED, PLUGIN_HANDLED_MAIN?
Thank you.

Last edited by ehha; 04-04-2009 at 08:29.
ehha is offline
slice231`SD
Senior Member
Join Date: Mar 2009
Location: Location: Location:
Old 03-21-2009 , 04:14   Re: adminchat modification
Reply With Quote #2

have you used colorchat.inc?
slice231`SD is offline
ehha
SourceMod Donor
Join Date: Apr 2006
Location: Sibiu
Old 03-21-2009 , 09:54   Re: adminchat modification
Reply With Quote #3

Nope.
__________________
ehha is offline
DruGzOG
Veteran Member
Join Date: Nov 2007
Location: Unknown
Old 04-01-2009 , 22:56   Re: adminchat modification
Reply With Quote #4

In this plugin-

plugin_handled_main isn't really necessary.

And what you want I dont really understand

Code:
/* Plugin generated by Zombie Zealots
||||||||||www.zombiezealots.com||||||||||
Enjoy the Plugin */
#include <amxmodx>
#define PLUGIN "Chat"
#define VERSION "1.0"
#define AUTHOR "Ehha"

public plugin_init()
{
    register_clcmd("say", "chat123", ADMIN_ALL, "@stuff"),
    register_clcmd("say_team", "chat123", ADMIN_ALL, "@stuff")
}
public chat123(id, level, cid)
{
    if(get_user_flags(id) & ADMIN_CHAT)
        return PLUGIN_CONTINUE
    new said[2]
    read_argv(1, said, 1)
    
    if (said[0] != '@')
        return PLUGIN_CONTINUE
    
    new message[192], name[32], players[32], inum, authid[32], userid
    
    read_args(message, 191)
    remove_quotes(message)
    get_user_authid(id, authid, 31)
    get_user_name(id, name, 31)
    userid = get_user_userid(id)
    get_players(players, inum)
    
    log_amx("Chat: ^"%s<%d><%s><>^" chat ^"%s^"", name, userid, authid, message)
    log_message("^"%s<%d><%s><>^" triggered ^"admin_chat^" (text ^"%s^")", name, userid, authid, message)
    
    format(message, 191, "(Admin Chat) %s :   %s", name, message[1])
    console_print(id, "%s", message)
    
    for (new i = 0; i < inum; ++i)
    {
        if (access(players[i], ADMIN_CHAT))
            client_print(players[i], print_chat, "%s", message)
    }
    
    return PLUGIN_HANDLED
}
__________________
DruGzOG is offline
Send a message via AIM to DruGzOG
ehha
SourceMod Donor
Join Date: Apr 2006
Location: Sibiu
Old 04-02-2009 , 06:42   Re: adminchat modification
Reply With Quote #5

Thanks for the info.
I want to make a shortcut for amx_chat in the normal chat (say command).
This shortcut will use '@' so:

Code:
public chat123(id, level, cid) { if( (sayd[0]==@) && (get_user_flags(id) & ADMIN_CHAT) ) display message without @ for all players with admin_chat flag else display the full message (with @) in normal say (like this plugin did not exists) }

Now, the way i tried it blocks normal chat for non-admin users, after i fixed that, messages (with @ in front) from non-admin users don't display at all & triggers the logs (this should not happen for non-admin users).

LATER EDIT: I managed to do it myself with your help on the return plugin_handeld, thanks again.

Last edited by ehha; 04-04-2009 at 08:29.
ehha 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 09:00.


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