AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Block console commands (https://forums.alliedmods.net/showthread.php?t=134227)

Vechta 08-02-2010 10:29

Block console commands
 
How i can block the command
jointeam 2 and jointeam 5?

Raddish 08-02-2010 10:36

Re: Block console commands
 
PHP Code:

#include <amxmodx>
#include <cstrike>

public plugin_init()
{
    
register_plugin("Register Command""2.0""Alucard")
}

public 
client_command(id)
{
    static 
argv[16]
    
read_argv(0argvcharsmax(argv) )
    
    if(
equali(argv"jointeam") && !cs_get_user_team) return PLUGIN_HANDLED


Thanks to Alucard^

http://forums.alliedmods.net/showpos...&postcount=134

Possible bug fix

PHP Code:

#include <amxmodx>
#include <cstrike>

public plugin_init()
{
    
register_plugin("Register Command""2.0""Alucard")
}

public 
client_command(id)
{
    static 
argv[16]
    
read_argv(0argvcharsmax(argv) )
    
    if(
equali(argv"jointeam") && cs_get_user_team(id) != CS_TEAM_UNASSIGNED) return PLUGIN_HANDLED

    
return PLUGIN_CONTINUE



Vechta 08-02-2010 12:21

Re: Block console commands
 
Thanks, possible to block only teamjoin 2 to teamjoin9 ?

ConnorMcLeod 08-02-2010 12:38

Re: Block console commands
 
If you want to always block :

PHP Code:

#include <amxmodx>

#define VERSION "0.0.1"

public plugin_init()
{
    
register_plugin("block jointeam"VERSION"ConnorMcLeod")

    
register_clcmd("jointeam 2""BlockJoinTeam")
    
register_clcmd("jointeam 5""BlockJoinTeam")
}

public 
BlockJoinTeam()
{
    return 
PLUGIN_HANDLED



If you want to allow primo joiners :

PHP Code:

#include <amxmodx>
#include <cstrike>

#define VERSION "0.0.1"

public plugin_init()
{
    
register_plugin("block jointeam"VERSION"ConnorMcLeod")

    
register_clcmd("jointeam 2""BlockJoinTeam")
    
register_clcmd("jointeam 5""BlockJoinTeam")
}

public 
BlockJoinTeam(id)
{
    return !(
cs_get_user_team(id) == CS_TEAM_UNASSIGNED)




If you want to allow jointeam from all kind of spectators :

PHP Code:

#include <amxmodx>
#include <cstrike>

#define VERSION "0.0.1"

public plugin_init()
{
    
register_plugin("block jointeam"VERSION"ConnorMcLeod")

    
register_clcmd("jointeam 2""BlockJoinTeam")
    
register_clcmd("jointeam 5""BlockJoinTeam")
}

public 
BlockJoinTeam(id)
{
    new 
CsTeams:iTeam cs_get_user_team(id)
    return !(
iTeam == CS_TEAM_UNASSIGNED || iTeam == CS_TEAM_SPECTATOR)



Note that old style menus don't send jointeam command.

Vechta 08-02-2010 13:49

Re: Block console commands
 
Dont work :S

Raddish 08-02-2010 16:36

Re: Block console commands
 
Quote:

Originally Posted by Vechta (Post 1259479)
Dont work :S

my code?

nikodz 08-02-2010 17:33

Re: Block console commands
 
PHP Code:

#include <amxmodx>
#include <cstrike>



public plugin_init() {
    
    
register_clcmd("jointeam 2""blockjoin")
    
register_clcmd("jointeam 5""blockjoin")
    
}

public 
blockjoin(id)
{
    if(
cs_get_user_team(id)==CS_TEAM_SPECTATOR || cs_get_user_team(id)==CS_TEAM_UNASSIGNED){
        return 
PLUGIN_CONTINUE;
    }
    return 
PLUGIN_HANDLED;


like ConnorMcLeod post. but i think this is correct if his code didn't work

ConnorMcLeod 08-03-2010 05:36

Re: Block console commands
 
http://forums.alliedmods.net/showpos...81&postcount=2

You can also try to replace

engclient_cmd(id, "chooseteam")

with

engclient_cmd(id, "jointeam 1")


All times are GMT -4. The time now is 00:09.

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