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

Solved [L4D2] Incap Players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Uncle Jessie
Member
Join Date: May 2016
Location: Prison
Old 01-27-2017 , 09:14   [L4D2] Incap Players
Reply With Quote #1

hi, how to block the voting or any commands for incap players? any links to sample script.
PHP Code:
public Action:Jointeam2(clientargs)
{
    
ClientCommand(client,"jointeam 2");
    return 
Plugin_Handled;
}
public 
Action:Spectate(clientargs)
{
    
ChangeClientTeam(client1);
    return 
Plugin_Handled;


Last edited by Uncle Jessie; 01-27-2017 at 14:41.
Uncle Jessie is offline
Timocop
AlliedModders Donor
Join Date: Mar 2013
Location: Germany
Old 01-27-2017 , 10:09   Re: [L4D2] Incap Players
Reply With Quote #2

You mean like this?

PHP Code:
public void OnPluginStart()
{
    if(!
AddCommandListener(eCommandReceiver))
        
SetFailState("CommandListener not available!");
}

public 
Action eCommandReceiver(int client, const char[] commandint argc)
{
    
//IsClientIncap is pseudo-code, use what you want here
    
if(IsClientIncap(client)) {
        if(
StrEqual(command"jointeam"))
            return 
Plugin_Handled;
    }
    
    return 
Plugin_Continue;

Timocop is offline
Uncle Jessie
Member
Join Date: May 2016
Location: Prison
Old 01-27-2017 , 11:24   Re: [L4D2] Incap Players
Reply With Quote #3

Quote:
Originally Posted by Timocop View Post
You mean like this?
Mean check that the player incapacitated and block commands like this. I did not find something like that here.

PHP Code:
public OnPluginStart()
{
    
RegConsoleCmd("sm_join"Jointeam2);
    
RegConsoleCmd("sm_afk"Spectate);
}
public 
Action:Jointeam2(clientargs)
{
    
ClientCommand(client,"jointeam 2");
    return 
Plugin_Handled;
}
public 
Action:Spectate(clientargs)
{
    
ChangeClientTeam(client1);
    return 
Plugin_Handled;


Last edited by Uncle Jessie; 01-27-2017 at 11:25.
Uncle Jessie is offline
Timocop
AlliedModders Donor
Join Date: Mar 2013
Location: Germany
Old 01-27-2017 , 11:48   Re: [L4D2] Incap Players
Reply With Quote #4

You can search in other peoples plugins for that or use NetProps, good for starters.

PHP Code:
/**
* Is client Incapacitated (L4D)
*/
stock bool:Client_IsInIncapped(client)
{
    return (
GetEntProp(clientProp_Send"m_isIncapacitated"1) > 0);

PHP Code:

public OnPluginStart()
{
    
RegConsoleCmd("sm_join"Jointeam2);
    
RegConsoleCmd("sm_afk"Spectate);
}

public 
Action:Jointeam2(clientargs)
{
    if(!
IsValidClient(client) || IsClientIncapped(client))
    return 
Plugin_Handled;
    
    
FakeClientCommand(client,"jointeam 2");
    return 
Plugin_Handled;
}

public 
Action:Spectate(clientargs)
{
    if(!
IsValidClient(client) || IsClientIncapped(client))
    return 
Plugin_Handled;
    
    
ChangeClientTeam(client1);
    return 
Plugin_Handled;
}

stock bool:IsValidClient(client)
{
    return (
client 0
            
&& client <= MaxClients
            
&& IsClientInGame(client));
}

stock bool:IsClientIncapped(client)
{
    return (
GetEntProp(clientProp_Send"m_isIncapacitated"1) > 0);

Timocop is offline
Uncle Jessie
Member
Join Date: May 2016
Location: Prison
Old 01-27-2017 , 14:41   Re: [L4D2] Incap Players
Reply With Quote #5

Quote:
Originally Posted by Timocop View Post
You can search in other peoples plugins for that or use NetProps, good for starters.
It works, thank you very much!
Uncle Jessie 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 11:22.


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