Thread: [Solved] [L4D2] Incap Players
View Single Post
Timocop
AlliedModders Donor
Join Date: Mar 2013
Location: Germany
Old 01-27-2017 , 10: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