Raised This Month: $ Target: $400
 0% 

Need help with code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
asdfdsdf
AlliedModders Donor
Join Date: Aug 2010
Location: Belgium
Old 07-09-2013 , 14:39   Need help with code
Reply With Quote #1

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;

asdfdsdf is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 07-09-2013 , 15:35   Re: Need help with code
Reply With Quote #2

Here's a hint.

PHP Code:
if(cs_get_user_team(id) == CS_TEAM_CT && !( get_user_flags(id) & ADMIN_BAN ) ) 
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
asdfdsdf
AlliedModders Donor
Join Date: Aug 2010
Location: Belgium
Old 07-10-2013 , 13:44   Re: Need help with code
Reply With Quote #3

Quote:
Originally Posted by wickedd View Post
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
asdfdsdf is offline
kimilover
Junior Member
Join Date: Oct 2010
Old 07-10-2013 , 13:47   Re: Need help with code
Reply With Quote #4

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?
kimilover is offline
asdfdsdf
AlliedModders Donor
Join Date: Aug 2010
Location: Belgium
Old 07-10-2013 , 14:32   Re: Need help with code
Reply With Quote #5

Quote:
Originally Posted by kimilover View Post
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
asdfdsdf is offline
kimilover
Junior Member
Join Date: Oct 2010
Old 07-10-2013 , 15:34   Re: Need help with code
Reply With Quote #6

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.

Last edited by kimilover; 07-11-2013 at 03:39. Reason: because this code doesnot work perfect i made a new with myself
kimilover is offline
asdfdsdf
AlliedModders Donor
Join Date: Aug 2010
Location: Belgium
Old 07-10-2013 , 16:23   Re: Need help with code
Reply With Quote #7

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
asdfdsdf is offline
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 06:20.


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