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

Team Restriction Plugin Availble?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jillchang
Senior Member
Join Date: Mar 2014
Old 02-12-2017 , 22:44   Team Restriction Plugin Availble?
Reply With Quote #1

Is there a plugin that allows team restrictions for a command?
I want to use Tony's piggyback plugin but has no team restriction. Tried asking on his thread but got no response.
https://forums.alliedmods.net/showth...=291893&page=4

I thought maybe there is a plugin that does this for any command, seems like something that people would use.

Last edited by Jillchang; 02-12-2017 at 22:44.
Jillchang is offline
Chaosxk
Veteran Member
Join Date: Aug 2010
Location: Westeros
Old 02-13-2017 , 02:25   Re: Team Restriction Plugin Availble?
Reply With Quote #2

Here you go, i hard-coded the values since i was lazy. Add in whatever commands you want to restrict in commands[][] and change restrict_team to the team you want to use the command.
2 = RED, 3 = BLUE teams for TF2
2 = T, 3 = CT ???
I could be wrong with T/CT team numbers, i'm only guessing it.

PHP Code:
#include <sourcemod>
#include <sdktools>

#define restrict_team 2

char commands[][] = {
    
"sm_slay",
    
"sm_kick",
    
"sm_ban"
}

public 
Action OnClientCommand(int clientint args)
{
    
char buffer[32];
    
GetCmdArg(0buffer32);
    
    for (
int i 0sizeof(commands); ++i)
    {
        if (!
strcmp(buffercommands[i]))
        {
            if (
GetClientTeam(client) != restrict_team)
                return 
Plugin_Stop;
            break;
        }
    }
    return 
Plugin_Continue;

__________________

Last edited by Chaosxk; 02-13-2017 at 02:25.
Chaosxk is offline
Jillchang
Senior Member
Join Date: Mar 2014
Old 02-13-2017 , 16:09   Re: Team Restriction Plugin Availble?
Reply With Quote #3

this is great, I'll test it out as soon as I get the chance.
This should be posted as a plugin since I think it is a functionality people want for a lot of plugins.

Thank you Choasxk!

Last edited by Jillchang; 02-13-2017 at 16:10. Reason: forgot to say ty
Jillchang is offline
Bladesmc
Junior Member
Join Date: May 2016
Old 02-15-2017 , 16:13   Re: Team Restriction Plugin Availble?
Reply With Quote #4

PHP Code:
#include <cstrike> 
Now you can use CS_TEAM_T and CS_TEAM_CT instead of numbers.
__________________
My plugins:
Bladesmc 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 17:59.


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