AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   No chat plugin (https://forums.alliedmods.net/showthread.php?t=145471)

dj_freeze 12-16-2010 13:05

No chat plugin
 
Hello AlliedModders!

I need a plugin with next functions:

1. It will turn chat off for everyone on server.
2. Admins with any flag can chat.
3. 2 players from top15 can chat.
4. I can add a player to users.ini with flag "m" so he could chat too.

I need this plugin very much.. Thanks.

hleV 12-16-2010 13:59

Re: No chat plugin
 
Code:
#include <amxmodx> //#include <amxmisc> #include <csx>   public plugin_init() {         register_clcmd("say", "Say");         register_clcmd("say_team", "Say"); }   public Say(id) {         if (get_user_flags(id)) // is_user_admin(id)                 return PLUGIN_CONTINUE;           new stats[8];           return get_user_stats(id, stats, stats) <= 2 ? PLUGIN_CONTINUE : PLUGIN_HANDLED; }

dj_freeze 12-16-2010 14:33

Re: No chat plugin
 
Quote:

Originally Posted by hleV (Post 1372297)
Code:
#include <amxmodx> //#include <amxmisc> #include <csx>   public plugin_init() {         register_clcmd("say", "Say");         register_clcmd("say_team", "Say"); }   public Say(id) {         if (get_user_flags(id)) // is_user_admin(id)                 return PLUGIN_CONTINUE;           new stats[8];           return get_user_stats(id, stats, stats) <= 2 ? PLUGIN_CONTINUE : PLUGIN_HANDLED; }

Sorry man.. Tested on my server but it doesn't work.. Players still can write in chat.

Exolent[jNr] 12-16-2010 14:45

Re: No chat plugin
 
Quote:

Originally Posted by dj_freeze (Post 1372321)
Sorry man.. Tested on my server but it doesn't work.. Players still can write in chat.

Make sure you don't have any other chat plugins running.

EDIT:

Checking get_user_flags() doesn't check if player is an admin because non-admins have flags too.

Code:
stock is_user_admin(id) {     return ((get_user_flags(id) & ~ADMIN_USER) > 0); }

So change it to:

Code:
if (get_user_flags(id) & ~ADMIN_USER)

dj_freeze 12-16-2010 14:48

Re: No chat plugin
 
I didn't understand what to change :S
Like this?

PHP Code:

#include <amxmodx>
//#include <amxmisc>
#include <csx>
 
public plugin_init()
{
        
register_clcmd("say""Say");
        
register_clcmd("say_team""Say");
}
 
public 
Say(id)
{
        if (
get_user_flags(id) & ~ADMIN_USER)
                return 
PLUGIN_CONTINUE;
 
        new 
stats[8];
 
        return 
get_user_stats(idstatsstats) <= PLUGIN_CONTINUE PLUGIN_HANDLED;



Chat plugins like what?
Only this chat plugins rugging.
adminchat.amxx ; console chat commands
antiflood.amxx ; prevent clients from chat-flooding the server
scrollmsg.amxx ; displays a scrolling message
imessage.amxx ; displays information messages

visar1 12-16-2010 15:14

Re: No chat plugin
 
in this
"//#include <amxmisc>"

delete //

;)

dj_freeze 12-16-2010 17:25

Re: No chat plugin
 
why?

Exolent[jNr] 12-16-2010 17:59

Re: No chat plugin
 
Quote:

Originally Posted by dj_freeze (Post 1372338)
I didn't understand what to change :S
Like this?

Yes, that is all you have to change. You should test before posting.

dj_freeze 12-16-2010 18:14

Re: No chat plugin
 
Quote:

Originally Posted by Exolent[jNr] (Post 1372398)
Yes, that is all you have to change. You should test before posting.

Tested. Working. And what is this: //#include <amxmisc> ?

Exolent[jNr] 12-16-2010 18:15

Re: No chat plugin
 
Quote:

Originally Posted by dj_freeze (Post 1372405)
Tested. Working. And what is this: //#include <amxmisc> ?

It commented that line from including amxmisc.inc, which has that stock is_user_admin().
hleV decided not to include it, even though it's better to use functions that are already given than reinventing the wheel.


All times are GMT -4. The time now is 04:51.

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