AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Client_Cmd Problem: (https://forums.alliedmods.net/showthread.php?t=214101)

Crizzatu 04-23-2013 03:30

Client_Cmd Problem:
 
Code:

public ClearChat(id)
        {
       
        if(!is_user_admin(id))
                return 1;
       
        new AdminName[32];
        get_user_name(id, AdminName, sizeof AdminName - 1);
        client_print_green(0, "          ADMINUL %s a curatat chatu!          ", AdminName);
        client_print_green(0,"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
        client_print_green(0,"        ;(Motiv:Reclama sau Vulgarisme)        ");
        client_print_green(0,"              ---=JB.Freakz.Ro=---            ");
        client_print_green(0,"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
       
        client_cmd(0, "spk misc/antend.wav");
        client_cmd(0, "clear");
        return 1;
}

This plugin is for ClearChat ! [advertisements or injury]

How can that when whrite /clearchat clean chat only PLAYERS ! Are not deleted chat and for Admin's?

Sorry! For my Language .... Is not the best...

^SmileY 04-23-2013 08:03

Re: Client_Cmd Problem:
 
return 1;

In amxconst

PHP Code:

#define PLUGIN_CONTINUE        0    /* Results returned by public functions */
#define PLUGIN_HANDLED        1    /* stop other plugins */
#define PLUGIN_HANDLED_MAIN    2    /* to use in client_command(), continue all plugins but stop the command */ 

So >

return 1 >> return PLUGIN_HANDLED;

PHP Code:

if(!is_user_admin(id))
        return 
1

TO

PHP Code:

if(!is_user_admin(id))
        return 
PLUGIN_HANDLED

Its is delete the chat from all persos, including for Admins..

You want to clear chat for all players except for Admins?

Crizzatu 04-23-2013 11:01

Re: Client_Cmd Problem:
 
Yes.. I want clear chat for all players except for admins :D .....:P

^SmileY 04-23-2013 12:33

Re: Client_Cmd Problem:
 
One second..

EDIT (NOT TESTED):

PHP Code:

#include <amxmodx>
#include <amxmisc>

public plugin_init()
{
    
register_plugin("Clear Chat",AMXX_vERSION_STR,"SmileY");
    
    
register_concmd("amx_chat_clear","cmdClearChat",ADMIN_RESERVATION,"- Clear all chat from users");
}

public 
cmdClearChat(id,level,cid)
{
    if(!
cmd_access(id,level,cid,1)) return PLUGIN_HANDLED;
    
    new 
iPlayers[32],iNum,Players;
    
get_players(iPlayers,iNum,"ch");
    
    new 
szName[32];
    
get_user_name(id,szName,charsmax(szName));
    
    for(new 
i;iNum;i++)
    {
        
Players iPlayers[i];
        
        if(
access(Players,ADMIN_RESERVATION)) continue;
        
// ADMIN_RESERVATION FLAG WILL REMOVE THE ADMIN FROM LOOP
        
        
client_print_green(Players,"           ADMINUL %s a curatat chatu!           ",szName);
        
client_print_green(Players,"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
        
client_print_green(Players,"         ;(Motiv:Reclama sau Vulgarisme)        ");
        
client_print_green(Players,"              ---=JB.Freakz.Ro=---             "); 
        
client_print_green(Players,"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
        
        
client_cmd(Players,"speak misc/antend.wav;wait;clear");
    }
    return 
PLUGIN_HANDLED;



Crizzatu 04-23-2013 14:50

Re: Client_Cmd Problem:
 
Now only the who writes is clear chat ! I need clear chat for ALL PLAYER [ FLAG Z ] except ADMIN'S [ADMIN_REZERVATION]

Thx for helping me

^SmileY 04-23-2013 15:13

Re: Client_Cmd Problem:
 
For reservation Slots

PHP Code:

register_concmd("amx_chat_clear","cmdClearChat",ADMIN_CHAT,"- Clear all chat from users"); 

to

PHP Code:

register_concmd("amx_chat_clear","cmdClearChat",ADMIN_RESERVATION,"- Clear all chat from users"); 

You testing the plugin? Its clear for all players the chat ? and for admin?

I didn't understand

Ps. See the code above

Crizzatu 04-23-2013 15:29

Re: Client_Cmd Problem:
 
Is GOOD ! THX MAN !


All times are GMT -4. The time now is 10:52.

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