AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need help with code (https://forums.alliedmods.net/showthread.php?t=220324)

asdfdsdf 07-09-2013 14:39

Need help with code
 
Hello i found a code here on AM so cts can type /voice to enable/disable terrorists voice only my admins can use that command on ct team i need to know so they can also enable it on T Side heres the code

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>

new terrorist_voice 0;

public 
plugin_init()
{
    
register_plugin("Disable Voice For Terrorist""1.0""GPOWER")
    
    
register_forward(FM_Voice_SetClientListening"Voice_Listen"0); 
    
    
register_concmd ("amx_terovoice""voice_tero"ADMIN_BAN"- Turns ON or OFF voice for Terrorist" );
    
register_clcmd("say /voice""change_voice")
}
public 
change_voice(id)
{
    if(
cs_get_user_team(id) == CS_TEAM_CT && !( get_user_flags(id) & ADMIN_BAN ) )
   {
        switch(
terrorist_voice)
        {
            case 
0:
            {
                
terrorist_voice 1;
            }
            case 
1:
            {
                
terrorist_voice 0;
            }
        }
    }
}
public 
voice_tero id ) {
    new 
arg[2];
    
read_argv 1arg);
    
    if ( 
equal arg"1" ) ) 
    {
        
terrorist_voice 1;
    } 
    else if ( 
equal arg"0" ) ) 
    {
        
terrorist_voice 0
    

    else 
    {
        if ( 
terrorist_voice == ){
            
console_print id"Usage: amx_terovoice 1 = 0n 0 = off Currently: 0" );
        }
        if ( 
terrorist_voice == ){
            
console_print id"Usage: amx_terovoice 1 = 0n 0 = off Currently: 1" );
        }
    }
    
    return 
PLUGIN_CONTINUE;
}
public 
Voice_Listen(iReceiveriSender)
{
    if(!
is_user_connected(iReceiver) || !is_user_connected(iSender) || iReceiver == iSender)
        return 
FMRES_IGNORED
        
    if(
terrorist_voice == 0)
    {
        if(
cs_get_user_team(iSender) == CS_TEAM_T || !is_user_alive(iSender))
        {
            
engfunc(EngFunc_SetClientListeningiReceiveriSender0);
            return 
FMRES_SUPERCEDE;
        }
    }
    else if(
terrorist_voice == 1)
    {
        if(!
is_user_alive(iSender))
        {
            
engfunc(EngFunc_SetClientListeningiReceiveriSender0);
            return 
FMRES_SUPERCEDE;
        }
    }
    return 
FMRES_IGNORED;



wickedd 07-09-2013 15:35

Re: Need help with code
 
Here's a hint.

PHP Code:

if(cs_get_user_team(id) == CS_TEAM_CT && !( get_user_flags(id) & ADMIN_BAN ) ) 


asdfdsdf 07-10-2013 13:44

Re: Need help with code
 
Quote:

Originally Posted by wickedd (Post 1987156)
Here's a hint.

PHP Code:

if(cs_get_user_team(id) == CS_TEAM_CT && !( get_user_flags(id) & ADMIN_BAN ) ) 


the meaning is that only admins can use the /voice command and that they also can use the command on T Side also i want admins that they can talk as T not regular players grtz

kimilover 07-10-2013 13:47

Re: Need help with code
 
You want the admins who are in Terrorist team can chat when the voice has disabled or you want the admin who re in Terrorists can chat and use the /voice command?

asdfdsdf 07-10-2013 14:32

Re: Need help with code
 
Quote:

Originally Posted by kimilover (Post 1987824)
You want the admins who are in Terrorist team can chat when the voice has disabled or you want the admin who re in Terrorists can chat and use the /voice command?


the last i want so admins can use /voice in Tside and aslo can talk in Tside regulars only in ct team only if admins enable the voice for Ts when there is a specified game in jailbreak grtz

kimilover 07-10-2013 15:34

Re: Need help with code
 
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "Terrorist Voice Enable"
#define VERSION "1.0"
#define AUTHOR "Nefos"

new bool:disable_voice

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /voice""voicechange")
    
register_clcmd("say""voicestatus")
}

public 
voicechange(id) {
    if (
cs_get_user_team(id) == CS_TEAM_CT || has_flag(id"j")) {
        if (
disable_voice == false) {
            
disable_voice true
            client_print
(idprint_chat"[AMXX] You have disabled the voice for terrorists")
        }
        else if (
disable_voice == true) {
            
disable_voice false
            client_print
(idprint_chat"[AMXX] You have enable the voice for terrorists")
        }
    }
    return 
PLUGIN_CONTINUE
}

public 
voicestatus(id) {
    if (
cs_get_user_team(id) == CS_TEAM_T && !(has_flag(id"j")))
    {
        if (
disable_voice == true) {
            return 
PLUGIN_HANDLED
        
}
        else if (
disable_voice == false) {
            return 
PLUGIN_CONTINUE
        
}
    }
    return 
PLUGIN_CONTINUE


man i tested the previous code and it doesnt work this works perfect i made it by myself.

asdfdsdf 07-10-2013 16:23

Re: Need help with code
 
well thx bro i will test it right away could you help me with something else aswell and the plugin works but if admins type /voice on Tside it doesnt enable/disable the voice for Ts


I also need help with a weaponspawnbug on my jailbreak server Ts get a glock sometimes or can just buy it is there a plugin that can make so Ts dont spawn with any weapons grtz


All times are GMT -4. The time now is 06:20.

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