Raised This Month: $7 Target: $400
 1% 

Help, I need to limit the input of the command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bruno_Ferrari
Member
Join Date: Oct 2016
Old 07-31-2017 , 10:17   Help, I need to limit the input of the command
Reply With Quote #1

How to ban a command? !powerups for example, a blue team! Reds, they can use. Tell me please!!!!
Bruno_Ferrari is offline
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 08-01-2017 , 08:15   Re: Help, I need to limit the input of the command
Reply With Quote #2

Quote:
Originally Posted by Bruno_Ferrari View Post
a blue team! Reds, they can use. Tell me please!!!!
What???
__________________
My Plugins
SPCode


Steam: hexer504
Telegram: Hexah
Discord: Hexah#6903

If you like my work you can donate here!
Papero is offline
stephen473
Senior Member
Join Date: Jan 2017
Location: somewhere on earth
Old 08-04-2017 , 17:25   Re: Help, I need to limit the input of the command
Reply With Quote #3

?¿?¿?
__________________
Also known as Hardy`.

Feel free to contact me if you have a private plugin request!

My Steam Profile | Discord: Hardy`#3792
stephen473 is offline
Cooky
Veteran Member
Join Date: Jun 2010
Location: 127.0.0.1
Old 08-09-2017 , 02:59   Re: Help, I need to limit the input of the command
Reply With Quote #4

I think he said: block the command for the "Red" team, so only "Blue" can use it...
Cooky is offline
waylander3
Senior Member
Join Date: Sep 2015
Location: Russia, Norilsk
Old 08-13-2017 , 20:26   Re: Help, I need to limit the input of the command
Reply With Quote #5

Quote:
Originally Posted by Cooky View Post
I think he said: block the command for the "Red" team, so only "Blue" can use it...
And how it relates to SMAC?
waylander3 is offline
ThatKidWhoGames
Veteran Member
Join Date: Jun 2013
Location: IsValidClient()
Old 09-02-2017 , 18:51   Re: Help, I need to limit the input of the command
Reply With Quote #6

Quote:
Originally Posted by Bruno_Ferrari View Post
How to ban a command? !powerups for example, a blue team! Reds, they can use. Tell me please!!!!
Completely wrong section lmao but this template should work for ya:

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

ConVar cv_BlueTeam;
ConVar cv_RedTeam;

new 
bool:bBlueTeamCvar;
new 
bool:bRedTeamCvar;

public 
OnPluginStart()
{
    
// Replace with whatever command you want to block for a team
    
AddCommandListener(CommandBlock"command_you_want_to_block");

    
cv_BlueTeam CreateConVar("sm_command_block_blue""1""Block the blue team from using the command?"_true0.0true1.0);
    
bBlueTeamCvar GetConVarBool(cv_BlueTeam);

    
cv_RedTeam CreateConVar("sm_command_block_red""1""Block the blue team from using the command?"_true0.0true1.0);
    
bRedTeamCvar GetConVarBool(cv_RedTeam);
}

public 
Action CommandBlock(int client, const char[] commandint argc)
{
    if (
IsValidClient(client))
    {
        if (
bBlueTeamCvar && TF2_GetClientTeam(client) == TFTeam_Blue)
        {
            return 
Plugin_Stop;
            
// Blocks the command for the client on the blue team
        
}
        else if (
bRedTeamCvar && TF2_GetClientTeam(client) == TFTeam_Red)
        {
            return 
Plugin_Stop;
            
// Blocks the command for the client on the red team            
        
}
    }
    return 
Plugin_Continue;
}

stock bool IsValidClient(int clientbool bAllowBots falsebool bAllowDead true

    if (!(
<= client <= MaxClients) || !IsClientInGame(client) || (IsFakeClient(client) && !bAllowBots) || IsClientSourceTV(client) || IsClientReplay(client) || (!bAllowDead && !IsPlayerAlive(client))) 
    { 
        return 
false
    }
    return 
true;

Attached Files
File Type: sp Get Plugin or Get Source (tutorial.sp - 275 views - 1.4 KB)
ThatKidWhoGames is offline
Reply


Thread Tools
Display Modes

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 22:32.


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