Raised This Month: $ Target: $400
 0% 

Mute player..


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 01-28-2009 , 06:23   Mute player..
Reply With Quote #1

Hey,

i have to writ this so that admin can mute a Player on chat/VC...where is ma problem?
PHP Code:
#include <amxmodx>
#include <amxmisc>

#define MENU_SIZE    512
#define MENU_PLAYERS 8
#define VoiceCommMute 1
#if VoiceCommMute == 1

new const PLUGIN[]    = "amxx"
new const VERSION[]    = "1"
new const AUTHOR[]    = "amxxxx"

new const g_menutitle[][] =
{
    
"Chat Mute%60s%i/%i^n^n",
    
"\yChat Mute%60s%i/%i^n^n\w"
}

new const 
g_menutext1[][] =
{
    
"%i.[admin] %s ^n",
    
"\d%i. %s^n\w"
}

new const 
g_menutext2[][] =
{
    
"%i.[%s] %s ^n",
    
"%i. \r%s \w%s\w^n"
}

new 
g_is_counterstrike

//xeroblood
new g_nMenuPosition[33]
new 
g_nMenuPlayers[32]
//xeroblood

new bool:gb_mute[33][33]

new 
Float:gf_time[33]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /chatmute""cmd_mutemenu")
    
register_clcmd("amx_chatmute",    "cmd_chatmute", -1"<name>")
    
register_clcmd("amx_chatmutemenu""cmd_mutemenu", -1"displays chat mute menu")
    
    
register_menucmd(register_menuid("Chat Mute"),        1023,    "handle_mutemenu")
    
    
register_message(get_user_msgid("SayText"), "message_SayText")
    
    new 
modname[32]
    
get_modname(modname31)
    
    if(
equal(modname"cstrike"))
    {
        
g_is_counterstrike 1
    
}
}

public 
message_SayText(iMsgidiDestreceiver)
{
    static 
sender
    sender 
get_msg_arg_int(1)
    
    if(
gb_mute[receiver][sender])
        return 
PLUGIN_HANDLED
    
    
return PLUGIN_CONTINUE
}

public 
cmd_chatmute(id)
{
    new 
arg1[32]
    
    
read_argv(1arg131)
    
    if(!
arg1[0])
    {
        
client_print(idprint_console"Usage:  amx_mute <name>")
        return 
PLUGIN_HANDLED
    
}
    
    new 
player cmd_target(idarg10)
    
    if(
player)
    {
        
exec_mute(idplayer)
        
    if(
get_cvar_num("sv_alltalk") == 1)
    if(
flags 4
            
set_speak(idSPEAK_ALL)
    else 
            
set_speak(idSPEAK_NORMAL)
    }

    }
    
    return 
PLUGIN_HANDLED
}

public 
exec_mute(idtarget)
{
    if(
access(targetADMIN_KICK))
    {
        
client_print(idprint_console"[AMXX] You cannot mute an admin.")
        return 
0
    
}
    else if(
target == id)
    {
        
client_print(idprint_console"[AMXX] You can't mute yourself.")
        return 
0
    
}
    
    new 
Float:current_time get_gametime()
    new 
Float:interval get_cvar_float("amx_flood_time")
    
    if(
current_time gf_time[id] + interval)
    {
        
gf_time[id] = current_time
    
}
    else
    {
        
client_print(idprint_chat"[AMXX] Please wait %f seconds to mute again."interval)
        return 
0
    
}
    
    
gb_mute[id][target] = !gb_mute[id][target]
    
    new 
name[32], name2[32]
    
    
get_user_name(targetname31)
    
    
get_user_name(idname231)
    
    
client_print(0print_chat"[AMXX] %s has %smuted %s chat."name2, (gb_mute[id][target] ? "" "un"), name)
    
    return 
1
}

/*
    xeroblood's fantastic menu, customized
*/
public cmd_mutemenu(id)
{
    
show_mutemenu(idg_nMenuPosition[id] = 0)
    return 
PLUGIN_HANDLED
}

public 
handle_mutemenu(idkey)
{
    switch(
key)
    {
        case 
8show_mutemenu(id, ++g_nMenuPosition[id])
        
        case 
9show_mutemenu(id, --g_nMenuPosition[id])
        
        default:
        {
            new 
nPlayerID g_nMenuPlayers[g_nMenuPosition[id] * MENU_PLAYERS key]
            
            
exec_mute(idnPlayerID)
            
            
show_mutemenu(idg_nMenuPosition[id])
        }
    }
    
    return 
PLUGIN_HANDLED
}

public 
show_mutemenu(idpos)
{
    if(
pos 0) return

    new 
iiPlayerID
    
new szMenuBody[MENU_SIZE]
    new 
nCurrKey 0
    
new szUserName[32]
    new 
nStart pos MENU_PLAYERS
    
new nNum

    get_players
(g_nMenuPlayersnNum)

    if(
nStart >= nNum)
        
nStart pos g_nMenuPosition[id] = 0
    
    
new nLen format(szMenuBodyMENU_SIZE-1g_menutitle[g_is_counterstrike], ""pos+1, (nNum MENU_PLAYERS + ((nNum MENU_PLAYERS) ? )))
    new 
nEnd nStart MENU_PLAYERS
    
new nKeys = (1<<9)
    
    if( 
nEnd nNum )
        
nEnd nNum
    
    
for(nStartnEndi++)
    {
        
iPlayerID g_nMenuPlayers[i]
        
get_user_name(iPlayerIDszUserName31)
        
        if(
access(iPlayerIDADMIN_KICK) || iPlayerID == id)
        {
            
nCurrKey++
            
nLen += format(szMenuBody[nLen], (MENU_SIZE-1-nLen), g_menutext1[g_is_counterstrike], nCurrKeyszUserName)
        }
        else
        {
            
nKeys |= (1<<nCurrKey++)
            
nLen += format(szMenuBody[nLen], (MENU_SIZE-1-nLen), g_menutext2[g_is_counterstrike], nCurrKey, (gb_mute[id][iPlayerID] ? "mute" ""), szUserName)
        }
    }
    
    if(
nEnd != nNum)
    {
        
format(szMenuBody[nLen], (MENU_SIZE-1-nLen), "^n9. More...^n0. %s"pos "Back" "Exit")
        
nKeys |= (1<<8)
    }
    else
        
format(szMenuBody[nLen], (MENU_SIZE-1-nLen), "^n0. %s"pos "Back" "Exit")
    
    
show_menu(idnKeysszMenuBody, -1)
    
    return

__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 01-28-2009 , 11:03   Re: Mute player..
Reply With Quote #2

.. Show us the errors...
BOYSplayCS is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 01-28-2009 , 11:15   Re: Mute player..
Reply With Quote #3

Hey,

PHP Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c1997-2006 ITB CompuPhaseAMX Mod X Team

Warning
Loose indentation on line 92
Error
Undefined symbol "flags" on line 93
Error
Undefined symbol "set_speak" on line 94
Error
Number of arguments does not match definition on line 94
Error
Undefined symbol "set_speak" on line 96
Warning
: Function "cmd_chatmute" should return a value on line 99
Error
Invalid function or declaration on line 101
Error
Expected token"#endif"but found "-end of file-" on line 224

6 Errors
.
Could not locate output file C:\Dokumente und Einstellungen\One\Desktop\Untitled.amx (compile failed). 
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
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 01:38.


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