AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   hlss block (https://forums.alliedmods.net/showthread.php?t=125970)

FlyingHorse 05-04-2010 06:32

hlss block
 
Hello.. how do i edit this code so only admins can play music? and how do i add a message every time everyone tries to play music over hlss? a message something like this: ColorChat(id, RED, "This is a jailbreak server, no HLSS allowed."


Sorry for posting threads all the time at the forum.. But i'm a new coder and i'm learning.. and i have a jailbreak server so i want to complete the plugins

Code:

#include <amxmodx>
 
#define VERSION "0.1"
 
new p_enabled
 
public hlss_query( )
{
    if( get_pcvar_num( p_enabled ) )
    {
        new clnt[32], num
        get_players( clnt, num, "c" )
        for( new i = 0; i < num; i++ )
        {
            query_client_cvar( clnt[i], "voice_inputfromfile", "hlss_block" )
            query_client_cvar( clnt[i], "voice_forcemicrecord", "hlss_block" )
        }
    }
    return PLUGIN_HANDLED
}
 
public hlss_block( id, cvar[], value[] )
{
    if( get_pcvar_num( p_enabled ) > 0 )
    {
        new intval = str_to_num( value )
        if( equal( cvar, "voice_inputfromfile" ) && intval != 0 )
        {
            client_cmd( id, "voice_inputfromfile 0" )
            client_cmd( id, "-voicerecord" )
        }
        if( equal( cvar, "voice_forcemicrecord" ) && intval != 1 )
        {
            client_cmd( id, "voice_forcemicrecord 1" )
            client_cmd( id, "-voicerecord" )
        }
    }
    return PLUGIN_HANDLED
}
 
public plugin_init( )
{
    register_plugin( "HLSS Blocker", VERSION, "Ian Cammarata" )
    register_cvar( "HLSS Blocker", VERSION, FCVAR_SERVER )
 
    p_enabled = register_cvar( "amx_block_hlss", "1" )
 
    set_task( 1.0, "hlss_query",_,_,_,"b" )
 
    return PLUGIN_CONTINUE
}


drekes 05-04-2010 07:07

Re: hlss block
 
Quote:

Originally Posted by FlyingHorse (Post 1170022)
Hello.. how do i edit this code

Which code?

FlyingHorse 05-04-2010 07:11

Re: hlss block
 
oh.. i forgot to add it.. haha sec

drekes 05-04-2010 07:35

Re: hlss block
 
try this:
PHP Code:

#include <amxmodx>
#include <colorchat>
 
#define VERSION "0.1"
#define ACCESS ADMIN_KICK 
 
new p_enabled
 
public hlss_query( )
{
    if( 
get_pcvar_nump_enabled ) )
    {
        new 
clnt[32], num
        get_players
clntnum"c" )
        for( new 
0numi++ )
        {
            
query_client_cvarclnt[i], "voice_inputfromfile""hlss_block" )
            
query_client_cvarclnt[i], "voice_forcemicrecord""hlss_block" )
        }
    }
    return 
PLUGIN_HANDLED
}
 
public 
hlss_blockidcvar[], value[] )
{
    if(!
get_user_flags(id) && ACCESS)
    {
        
ColorChat(idRED"This is a jailbreak server, no HLSS allowed.")
        return 
PLUGIN_HANDLED
    
}
    
    if( 
get_pcvar_nump_enabled ) > )
    {
        new 
intval str_to_numvalue )
        if( 
equalcvar"voice_inputfromfile" ) && intval != )
        {
            
client_cmdid"voice_inputfromfile 0" )
            
client_cmdid"-voicerecord" )
        }
        if( 
equalcvar"voice_forcemicrecord" ) && intval != )
        {
            
client_cmdid"voice_forcemicrecord 1" )
            
client_cmdid"-voicerecord" )
        }
    }
    return 
PLUGIN_HANDLED
}
 
public 
plugin_init( )
{
    
register_plugin"HLSS Blocker"VERSION"Ian Cammarata" )
    
register_cvar"HLSS Blocker"VERSIONFCVAR_SERVER )
 
    
p_enabled register_cvar"amx_block_hlss""1" )
 
    
set_task1.0"hlss_query",_,_,_,"b" )
 
    return 
PLUGIN_CONTINUE




All times are GMT -4. The time now is 03:48.

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