Raised This Month: $ Target: $400
 0% 

AMXX Gag & Voices Management


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GhostMan
Senior Member
Join Date: Jun 2012
Old 04-26-2013 , 13:37   AMXX Gag & Voices Management
Reply With Quote #1

All i need from Voices Management plugin is that alive players would hear alive player and dead would hear all players, that's the only function i need from this plugin.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define VERSION "1.1"

#define MAX_PLAYERS    32

#define OFFSET_TEAM        114

new g_iClientSettings[MAX_PLAYERS+1][2]
new 
bool:g_bPlayerNonSpawnEvent[MAX_PLAYERS+1]
new 
g_iFwFmClientCommandPost
new bool:g_bAlive[MAX_PLAYERS+1]

new 
g_iMaxPlayers
new g_msgidSayText
new g_pcvarAlivesHearg_pcvarDeadsHear

public plugin_init()
{
    
register_plugin("Voices Management"VERSION"ConnorMcLeod")
    
register_dictionary("voicesmanagement.txt")
    
register_dictionary("common.txt")

    
g_pcvarAlivesHear register_cvar("vm_alives""1")  // 0:alive teamates , 1:alives , 2:all
    
g_pcvarDeadsHear register_cvar("vm_deads""2")    // 0:dead teamates , 1:deads , 2:all

    
register_forward(FM_Voice_SetClientListening"Forward_SetClientListening")
    
register_event("VoiceMask""Event_VoiceMask""b")

    
register_event("TextMsg""Event_TextMsg_Restart""a""2=#Game_will_restart_in")
    
register_event("ResetHUD""Event_ResetHUD""b")
    
register_event("DeathMsg""Event_DeathMsg""a")

    
register_clcmd("say /vm""ClientCommand_SayStatus")
    
register_clcmd("say_team /vm""ClientCommand_SayStatus")

    
register_clcmd("fullupdate""ClientCommand_fullupdate")
}

public 
plugin_cfg()
{
    
server_cmd("sv_alltalk 1;alias sv_alltalk")
    
server_exec()
    
g_iMaxPlayers get_maxplayers()
    
g_msgidSayText get_user_msgid("SayText")
}

public 
ClientCommand_SayStatus(id)
{
    new 
iDeads get_pcvar_num(g_pcvarDeadsHear), 
        
iAlives get_pcvar_num(g_pcvarAlivesHear)

    new 
szDeadsStatus[18], szAlivesStatus[19]

    switch(
iAlives)
    {
        case 
0:szAlivesStatus "VM_ALIVES_TEAMATES"
        
case 1:szAlivesStatus "VM_ALIVES"
        
case 2:szAlivesStatus "VM_ALL"
    
}

    switch(
iDeads)
    {
        case 
0:szDeadsStatus "VM_DEADS_TEAMATES"
        
case 1:szDeadsStatus "VM_DEADS"
        
case 2:szDeadsStatus "VM_ALL"
    
}

    
col_mess(idid"%L"id"VM_ALIVES_STATUS"idszAlivesStatus)
    
col_mess(idid"%L"id"VM_DEADS_STATUS"idszDeadsStatus)
}

public 
ClientCommand_fullupdate(id)
{
    
g_bPlayerNonSpawnEvent[id] = true
    
static const szFwFmClientCommandPost[] = "fwFmClientCommandPost"
    
g_iFwFmClientCommandPost register_forward(FM_ClientCommandszFwFmClientCommandPost1)
    return 
PLUGIN_CONTINUE
}

public 
fwFmClientCommandPost(iPlayerId) {
    
unregister_forward(FM_ClientCommandg_iFwFmClientCommandPost1)
    
g_bPlayerNonSpawnEvent[iPlayerId] = false
    
return FMRES_HANDLED
}

public 
Event_TextMsg_Restart()
{
    for(new 
id=1id <= g_iMaxPlayers; ++id)
    {
        if(
g_bAlive[id])
        {
            
g_bPlayerNonSpawnEvent[id] = true
        
}
    }
}

public 
Event_ResetHUD(id)
{
    if(!
is_user_alive(id))
    {
        return
    }

    if(
g_bPlayerNonSpawnEvent[id])
    {
        
g_bPlayerNonSpawnEvent[id] = false
        
return
    }
    
g_bAlive[id] = true
}

public 
client_putinserver(id)
{
    
g_bAlive[id] = false
}

public 
Event_DeathMsg()
{
    
g_bAlive[read_data(2)] = false
}

public 
Event_VoiceMask(id)
{
    
g_iClientSettings[id][0] = read_data(1)
    
g_iClientSettings[id][1] = read_data(2)
}

public 
Forward_SetClientListening(iReceiveriSenderbool:bListen)
{
    if(!
g_iClientSettings[iReceiver][0] || g_iClientSettings[iReceiver][1] & (1<<(iSender-1)))
    {
        return 
FMRES_IGNORED
    
}
    
    if(
g_bAlive[iReceiver])
    {
        switch(
get_pcvar_num(g_pcvarAlivesHear))
        {
            case 
0:
            {
                if(
g_bAlive[iSender] && get_pdata_int(iReceiverOFFSET_TEAM) == get_pdata_int(iSenderOFFSET_TEAM))
                {
                    
engfunc(EngFunc_SetClientListeningiReceiveriSendertrue)
                    
forward_return(FMV_CELLtrue)
                    return 
FMRES_SUPERCEDE
                
}
            }
            case 
1:
            {
                if(
g_bAlive[iSender])
                {
                    
engfunc(EngFunc_SetClientListeningiReceiveriSendertrue)
                    
forward_return(FMV_CELLtrue)
                    return 
FMRES_SUPERCEDE
                
}
            }
            case 
2:
            {
                
engfunc(EngFunc_SetClientListeningiReceiveriSendertrue)
                
forward_return(FMV_CELLtrue)
                return 
FMRES_SUPERCEDE
            
}
        }
    }
    else
    {
        switch(
get_pcvar_num(g_pcvarDeadsHear))
        {
            case 
0:
            {
                if(!
g_bAlive[iSender] && get_pdata_int(iReceiverOFFSET_TEAM) == get_pdata_int(iSenderOFFSET_TEAM))
                {
                    
engfunc(EngFunc_SetClientListeningiReceiveriSendertrue)
                    
forward_return(FMV_CELLtrue)
                    return 
FMRES_SUPERCEDE
                
}
            }
            case 
1:
            {
                if(!
g_bAlive[iSender])
                {
                    
engfunc(EngFunc_SetClientListeningiReceiveriSendertrue)
                    
forward_return(FMV_CELLtrue)
                    return 
FMRES_SUPERCEDE
                
}
            }
            case 
2:
            {
                
engfunc(EngFunc_SetClientListeningiReceiveriSendertrue)
                
forward_return(FMV_CELLtrue)
                return 
FMRES_SUPERCEDE
            
}
        }
    }

    
engfunc(EngFunc_SetClientListeningiReceiveriSenderfalse)
    
forward_return(FMV_CELLfalse)
    return 
FMRES_SUPERCEDE
}

col_mess(idsenderstring[], any:...)
{
    static 
szMessage[128]
    
szMessage[0] = 0x01
    vformat
(szMessage[1], 127string4)

    
replace_all(szMessage127"!n""^x01")
    
replace_all(szMessage127"!t""^x03")
    
replace_all(szMessage127"!g""^x04")

    
message_begin(MSG_ONE_UNRELIABLEg_msgidSayText_id)
    
write_byte(sender)
    
write_string(szMessage)
    
message_end()

I also use AMXX Gag plugin and from this plugin i need all functions (gag from chat and voice commands).

But if i use both plugins at once so with amx_gag i can't mute players from voice commands, if i disable Voices Management then everything works fine. Any suggestions how to fix this?

Last edited by GhostMan; 04-26-2013 at 13:38.
GhostMan is offline
Reply


Thread Tools
Display Modes

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 10:45.


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