AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved [L4D2] Incap Players (https://forums.alliedmods.net/showthread.php?t=293259)

Uncle Jessie 01-27-2017 08:14

[L4D2] Incap Players
 
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;



Timocop 01-27-2017 09:09

Re: [L4D2] Incap Players
 
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;



Uncle Jessie 01-27-2017 10:24

Re: [L4D2] Incap Players
 
Quote:

Originally Posted by Timocop (Post 2490273)
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;



Timocop 01-27-2017 10:48

Re: [L4D2] Incap Players
 
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);



Uncle Jessie 01-27-2017 13:41

Re: [L4D2] Incap Players
 
Quote:

Originally Posted by Timocop (Post 2490301)
You can search in other peoples plugins for that or use NetProps, good for starters.

It works, thank you very much!


All times are GMT -4. The time now is 06:14.

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