Raised This Month: $51 Target: $400
 12% 

Team talk and Mute


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
okletsgo
Junior Member
Join Date: Aug 2011
Old 08-04-2011 , 20:10   Team talk and Mute
Reply With Quote #1

I found this Plugin,When I use "amx_mute" :

Quote:
amx_mute #1
Client with that name or userid not found
Tell me by the square why it is so. Can fix ?

PHP Code:
/*
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>

new g_player_muted[33]
new Float: g_player_deathtime[33]
new p_teamtalk, p_talktime, p_talkhint

public plugin_init()
{
    register_plugin("Team Talk", "1.2", "Rulzy");
    register_forward(FM_Voice_SetClientListening, "fm_voice_forward")
    register_clcmd("amx_mute", "cmdMute", ADMIN_KICK, "<name or #userid> - Mute player's Microphone");
    register_clcmd("amx_unmute", "cmdUnMute", ADMIN_KICK, "<name or #userid> - UnMute player's Microphone");
    
    p_teamtalk = register_cvar("amx_teamtalk", "1");
    p_talktime = register_cvar("amx_talktime", "0");
    p_talkhint = register_cvar("amx_talkhint", "1");
    
    register_event("DeathMsg", "eDeathMsg", "a");
    
}

public eDeathMsg()
{
    new victim = read_data(2);
    if(!is_user_connected(victim)) return PLUGIN_CONTINUE;
    g_player_deathtime[victim] = get_gametime();
    if(get_cvar_num("sv_alltalk")) return PLUGIN_CONTINUE;
    if(!get_pcvar_num(p_teamtalk)) return PLUGIN_CONTINUE;
    if(g_player_muted[victim] && get_user_flags(victim)&ADMIN_IMMUNITY==0)  //如果此人被禁止讲话
        return PLUGIN_CONTINUE;
    if(!get_pcvar_num(p_talkhint))
        return PLUGIN_CONTINUE;
    new talktime = get_pcvar_num(p_talktime);
    talktime = talktime>0?talktime:-talktime;
    new param[3]
    param[0] = victim;
    param[1] = talktime;
    ShowHint(param);
    return PLUGIN_CONTINUE;
}

public ShowHint(param[])
{
    if(get_cvar_num("sv_alltalk")) return PLUGIN_CONTINUE;
    if(!get_pcvar_num(p_teamtalk)) return PLUGIN_CONTINUE;
    new id = param[0];
    new talktime = get_pcvar_num(p_talktime);
    new timeleft = param[1];
    new HintMsg[256];
    new talkhint = get_pcvar_num(p_talkhint);
    if(talkhint==1)
    {
        if(is_user_alive(id))
        {
            format(HintMsg, 255, "你已经出生, 现在你可以与你的队友正常语音通话");
            timeleft = 0;
        }else if(talktime==0){
            format(HintMsg, 255, "你挂了, 但你仍然可以与你的队友语音通话");
        }else if(talktime>0){
            if(timeleft==0)
                format(HintMsg, 255, "时间到, 你现在不能跟活着的队友通话了", timeleft);
            else
                format(HintMsg, 255, "你挂了, 但 %d 秒内你仍然可以与活着的队友通话", timeleft);
        }else{
            if(timeleft==0)
                format(HintMsg, 255, "你现在可以跟活着的队友通话了", timeleft);
            else
                format(HintMsg, 255, "你挂了, %d 秒后你可与活着的队友通话", timeleft);
        }
        set_hudmessage(255, 196, 196, -1.0, 0.73, 0, 0.0, 3.0, 0.0, 0.0, 1)
        show_hudmessage(id, HintMsg)
    }else if (talkhint==2){
        if(is_user_alive(id))
        {
            format(HintMsg, 255, "^x04【语音控制】^x01你已经出生, 现在你可以与你的队友正常语音通话。");
            timeleft = 0;
        }else if(talktime==0){
            format(HintMsg, 255, "^x04【语音控制】^x01你挂了, 但你仍然可以与你的队友语音通话。");
        }else if(talktime>0){
            if(timeleft==0)
                format(HintMsg, 255, "^x04【语音控制】^x01时间到, 你现在不能跟活着的队友通话了。", timeleft);
            else
                format(HintMsg, 255, "^x04【语音控制】^x01你挂了, 但 %d 秒内你仍然可以与活着的队友通话。", timeleft);
        }else{
            if(timeleft==0)
                format(HintMsg, 255, "^x04【语音控制】^x01你现在可以跟活着的队友通话了。", timeleft);
            else
                format(HintMsg, 255, "^x04【语音控制】^x01你挂了, %d 秒后你可与活着的队友通话。", timeleft);
        }
        client_color(id, id, HintMsg);
    }
    if(timeleft>0)
    {
        param[1]=timeleft-1;
        set_task(1.0, "ShowHint", 0, param, 2);
    }
    return PLUGIN_CONTINUE;
}

public fm_voice_forward(receiver, sender, listen)
{
    if(receiver==sender) return FMRES_IGNORED;
    new alltalk = get_cvar_num("sv_alltalk");
    if(alltalk) return FMRES_IGNORED;
    if(!get_pcvar_num(p_teamtalk)) return FMRES_IGNORED;
    if(!is_user_connected(receiver) || !is_user_connected(sender))
        return FMRES_IGNORED;
    if(g_player_muted[sender] && get_user_flags(sender)&ADMIN_IMMUNITY==0)  //如果此人被禁止讲话
    {
        engfunc(EngFunc_SetClientListening, receiver, sender, 0);
        return FMRES_SUPERCEDE;
    }
    new CsTeams:rt=cs_get_user_team(receiver);
    new CsTeams:st=cs_get_user_team(sender);
    if(rt==CS_TEAM_UNASSIGNED || rt==CS_TEAM_SPECTATOR)    //观察员可以听到所有人讲话
    {
        engfunc(EngFunc_SetClientListening, receiver, sender, 1);
        return FMRES_SUPERCEDE;
    }
    if(rt==st){  //如果是队友间讲话
        if(is_user_alive(sender))  //活着的队友讲话,队友都可以听到
        {
            engfunc(EngFunc_SetClientListening, receiver, sender, 1);
            return FMRES_SUPERCEDE;
        }
        //死亡的队友讲话,分两种情况
        if(!is_user_alive(receiver))  //一:死亡的队友可以听到死亡的队友讲话(包括两者都是观察员的情况)
        {
            engfunc(EngFunc_SetClientListening, receiver, sender, 1); 
            return FMRES_SUPERCEDE;
        }
        //二:如果讲话者是死的,听话者是活的,则根据参数和死亡时间来区分
        new talktime = get_pcvar_num(p_talktime);
        if(talktime == 0)
        {
            engfunc(EngFunc_SetClientListening, receiver, sender, 1); //总可以听到队友讲话
            return FMRES_SUPERCEDE;
        }
        new Float:gametime = get_gametime();
        if(talktime>0){  //队友死亡后多少秒内活着的队友可以听到,可用于报点,但可防止时间过后影响活着的队友发挥
            if(gametime-g_player_deathtime[sender]>talktime)//如果当前时间-最后死亡时间>指定的时间,则活的队友听不到讲话
            {
                engfunc(EngFunc_SetClientListening, receiver, sender, 0);
            }else{                            //否则(当前时间-最后死亡时间<=指定的时间),活的队友可听到讲话
                engfunc(EngFunc_SetClientListening, receiver, sender, 1);
            }
        }else{  //队友死亡后多少秒内活着的队友听不到,可防止报点,但这个时间过后可以进行战术指挥
            talktime = - talktime;  //取绝对值
            if(gametime-g_player_deathtime[sender]>talktime)//如果当前时间-最后死亡时间>指定的时间,则活的队友可听到讲话
            {
                engfunc(EngFunc_SetClientListening, receiver, sender, 1);
            }else{                            //否则(当前时间-最后死亡时间<=指定的时间),活的队友听不到讲话
                engfunc(EngFunc_SetClientListening, receiver, sender, 0);
            }
        }
    }else{  //否则听不到讲话(不是队友,也不是观察员)
        engfunc(EngFunc_SetClientListening, receiver, sender, 0);
    }
    
    return FMRES_SUPERCEDE;
}

public client_connect(id)
{
    g_player_muted[id] = 0;
    g_player_deathtime[id] = get_gametime();
}

public cmdMute(id, level, cid)
{
    if(!cmd_access(id, level, cid, 2))
        return PLUGIN_HANDLED;
    new name[32];
    read_argv(1, name, 31);
    new target = cmd_target(id, name, 1);
    if(!target) return PLUGIN_HANDLED;
    g_player_muted[target] = 1
    return PLUGIN_HANDLED;
}

public cmdUnMute(id, level, cid)
{
    if(!cmd_access(id, level, cid, 2))
        return PLUGIN_HANDLED;
    new name[32];
    read_argv(1, name, 31);
    new target = cmd_target(id, name, 0);
    if(!target) return PLUGIN_HANDLED;
    g_player_muted[target] = 0
    return PLUGIN_HANDLED;
}

stock client_color(playerid,colorid,msg[])
{
    message_begin(playerid?MSG_ONE:MSG_ALL, get_user_msgid("SayText"), {0,0,0}, playerid) 
    write_byte(colorid)
    write_string(msg)
    message_end()

okletsgo is offline
joshknifer
Veteran Member
Join Date: Jun 2011
Location: Denver, CO
Old 08-05-2011 , 10:43   Re: Team talk and Mute
Reply With Quote #2

What are you actually looking for can you be more specific? The amx_mute is not a command within the plugin that you posted, which is for setting alltalk or teamspeak within a server from what i can see. Are you trying to find a plugin that mutes a certain player?
__________________
joshknifer is offline
Send a message via Skype™ to joshknifer
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 08-05-2011 , 11:11   Re: Team talk and Mute
Reply With Quote #3

Quote:
Originally Posted by joshknifer View Post
What are you actually looking for can you be more specific? The amx_mute is not a command within the plugin that you posted, which is for setting alltalk or teamspeak within a server from what i can see. Are you trying to find a plugin that mutes a certain player?
What are you talking about?

PHP Code:
register_clcmd("amx_mute""cmdMute"ADMIN_KICK"<name or #userid> - Mute player's Microphone"); 
register_clcmd("amx_unmute""cmdUnMute"ADMIN_KICK"<name or #userid> - UnMute player's Microphone"); 
@OP Are you sure that the player with userid 1 is connected to the server?

Try with using part of the players name, as that will work as well.
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
joshknifer
Veteran Member
Join Date: Jun 2011
Location: Denver, CO
Old 08-05-2011 , 11:49   Re: Team talk and Mute
Reply With Quote #4

Ah i c, sorry my brain didnt register that part for some reason lol. I agree, just use the player's name or part of the name and it should work
__________________

Last edited by joshknifer; 08-05-2011 at 16:49.
joshknifer is offline
Send a message via Skype™ to joshknifer
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 13:08.


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