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

[REQ] [L4D2] Survivor Counter


Post New Thread Reply   
 
Thread Tools Display Modes
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 11-07-2013 , 11:12   Re: [REQ] [L4D2] Survivor Counter
Reply With Quote #21

You welcome ;3
__________________
Want to check my plugins ?
Arkarr is offline
noxman
Member
Join Date: Jun 2012
Old 01-06-2014 , 16:15   Re: [REQ] [L4D2] Survivor Counter
Reply With Quote #22

Quote:
Originally Posted by GsiX View Post
easy to debug..

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

public Plugin:myinfo =
{
    
name "L4D2_PlayerCounter",
    
author "GsiX",
    
description "Announce player number",
    
version "0.0",
    
url "https://forums.alliedmods.net/showpost.php?p=2054639&postcount=2"
}

public 
OnPluginStart()
{
    
HookEvent"player_spawn"EVENT_PlayerSpawn );
    
HookEvent"player_death"EVENT_PlayerDeath );
}

public 
EVENT_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserIdGetEventIntevent"userid" ));
    
    if ( 
IsTeamSurvivorclient ))
    {
        new 
counT CountSurvivor();
        
        if ( 
counT )
        {
            for ( new 
1<= MaxClientsi++ )
            {
                if ( 
IsTeamSurvivor))
                {
                    
PrintHintTexti"%N has Spawned, %d Survivor alive"clientcounT );
                }
            }
        }
    }
}

public 
EVENT_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserIdGetEventIntevent"userid" ));
    
    if ( 
IsTeamSurvivorclient ))
    {
        new 
counT CountSurvivor();
        
        if ( 
counT )
        {
            for ( new 
1<= MaxClientsi++ )
            {
                if ( 
IsTeamSurvivor))
                {
                    
PrintHintTexti"%N has Death, %d Survivor alive"clientcounT );
                }
            }
        }
    }
}

CountSurvivor()
{
    new 
survivoR 0;
        
    for ( new 
1<= MaxClientsi++ )
    {
        if ( 
IsTeamSurvivor) && IsPlayerAlive))
        {
            
survivoR++;
        }
    }
    return 
survivoR;
}

stock bool:IsTeamSurvivorclient )
{
    if ( 
client || client MaxClients ) return false;
    if ( !
IsClientConnectedclient )) return false;
    if ( !
IsClientInGameclient )) return false;
    if ( 
GetClientTeamclient ) != ) return false;
    return 
true;


I dont know why, but now its working perfect!!! Thanks!!!

One question. The Hint Message see only the survivors. I want that both teams can see the message "PLAYER has death ..."

If i replace "PrintHintText" with "PrintHintTextToAll" i get these Error:

error 035:argument type mismatch
noxman is offline
RU_6uK
SourceMod Donor
Join Date: May 2010
Old 01-06-2014 , 18:37   Re: [REQ] [L4D2] Survivor Counter
Reply With Quote #23

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

public Plugin:myinfo 

    
name "L4D2_PlayerCounter"
    
author "GsiX"
    
description "Announce player number"
    
version "0.0"
    
url "https://forums.alliedmods.net/showpost.php?p=2054639&postcount=2" 


public 
OnPluginStart() 

    
HookEvent"player_spawn"EVENT_PlayerSpawn ); 
    
HookEvent"player_death"EVENT_PlayerDeath ); 


public 
EVENT_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast

    new 
client GetClientOfUserIdGetEventIntevent"userid" )); 
     
    if ( 
IsTeamSurvivorclient )) 
    { 
        new 
counT CountSurvivor(); 
         
        if ( 
counT 
        { 
           
PrintHintTextToAll"%N has Spawned, %d Survivor alive"clientcounT ); 
        } 
    } 


public 
EVENT_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast

    new 
client GetClientOfUserIdGetEventIntevent"userid" )); 
     
    if ( 
IsTeamSurvivorclient )) 
    { 
        new 
counT CountSurvivor(); 
         
        if ( 
counT 
        { 
           
PrintHintTextToAll"%N has Death, %d Survivor alive"clientcounT ); 
        } 
    } 


CountSurvivor() 

    new 
survivoR 0
         
    for ( new 
1<= MaxClientsi++ ) 
    { 
        if ( 
IsTeamSurvivor) && IsPlayerAlive)) 
        { 
            
survivoR++; 
        } 
    } 
    return 
survivoR


stock bool:IsTeamSurvivorclient 

    if ( 
client || client MaxClients ) return false
    if ( !
IsClientConnectedclient )) return false
    if ( !
IsClientInGameclient )) return false
    if ( 
GetClientTeamclient ) != ) return false
    return 
true

RU_6uK is offline
noxman
Member
Join Date: Jun 2012
Old 01-09-2014 , 16:03   Re: [REQ] [L4D2] Survivor Counter
Reply With Quote #24

Quote:
Originally Posted by RU_6uK View Post
PHP Code:
#include <sourcemod> 
#include <sdktools> 

public Plugin:myinfo 

    
name "L4D2_PlayerCounter"
    
author "GsiX"
    
description "Announce player number"
    
version "0.0"
    
url "https://forums.alliedmods.net/showpost.php?p=2054639&postcount=2" 


public 
OnPluginStart() 

    
HookEvent"player_spawn"EVENT_PlayerSpawn ); 
    
HookEvent"player_death"EVENT_PlayerDeath ); 


public 
EVENT_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast

    new 
client GetClientOfUserIdGetEventIntevent"userid" )); 
     
    if ( 
IsTeamSurvivorclient )) 
    { 
        new 
counT CountSurvivor(); 
         
        if ( 
counT 
        { 
           
PrintHintTextToAll"%N has Spawned, %d Survivor alive"clientcounT ); 
        } 
    } 


public 
EVENT_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast

    new 
client GetClientOfUserIdGetEventIntevent"userid" )); 
     
    if ( 
IsTeamSurvivorclient )) 
    { 
        new 
counT CountSurvivor(); 
         
        if ( 
counT 
        { 
           
PrintHintTextToAll"%N has Death, %d Survivor alive"clientcounT ); 
        } 
    } 


CountSurvivor() 

    new 
survivoR 0
         
    for ( new 
1<= MaxClientsi++ ) 
    { 
        if ( 
IsTeamSurvivor) && IsPlayerAlive)) 
        { 
            
survivoR++; 
        } 
    } 
    return 
survivoR


stock bool:IsTeamSurvivorclient 

    if ( 
client || client MaxClients ) return false
    if ( !
IsClientConnectedclient )) return false
    if ( !
IsClientInGameclient )) return false
    if ( 
GetClientTeamclient ) != ) return false
    return 
true

works good thanks!
noxman is offline
Pyc
Senior Member
Join Date: Jan 2014
Old 05-08-2016 , 05:54   Re: [REQ] [L4D2] Survivor Counter
Reply With Quote #25

please, help
this plugin count bots too
how to count only survivor players? not bots
Pyc is offline
alasfourom
Senior Member
Join Date: Feb 2022
Location: Saudi Arabia
Old 05-21-2022 , 20:15   Re: [REQ] [L4D2] Survivor Counter
Reply With Quote #26

Does anyone fixed or can fix the issue where the spec is also counted as extra survivors

It announce extra survivors when "Any Survivors" go Spectate

Thanks

Last edited by alasfourom; 05-21-2022 at 20:16.
alasfourom is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 05-22-2022 , 10:36   Re: [REQ] [L4D2] Survivor Counter
Reply With Quote #27

You have to check if the NetClass is a SurvivorBot and has the m_humanSpectatorUserID set, if it is greater than 0 than is a bot with a human spec.

PHP Code:
    char netclass[12];
    
GetEntityNetClass(clientnetclasssizeof(netclass));
    if (
strcmp(netclass"SurvivorBot") == 0)
    {
        
int idler GetClientOfUserId(clientProp_Send"m_humanSpectatorUserID");
    } 
__________________

Last edited by Marttt; 05-22-2022 at 10:37.
Marttt is online now
alasfourom
Senior Member
Join Date: Feb 2022
Location: Saudi Arabia
Old 05-23-2022 , 13:39   Re: [REQ] [L4D2] Survivor Counter
Reply With Quote #28

I'm not a scripter Martt

But I hopefully can learn from you, how do I check that ;D
alasfourom is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 05-23-2022 , 17:13   Re: [REQ] [L4D2] Survivor Counter
Reply With Quote #29

Try checking https://forums.alliedmods.net/showthread.php?t=306230
__________________
Marttt is online now
alasfourom
Senior Member
Join Date: Feb 2022
Location: Saudi Arabia
Old 07-30-2022 , 11:55   Re: [REQ] [L4D2] Survivor Counter
Reply With Quote #30

I did check that, but the issue now it starts counting survivor bots only and ignoring the real human

Last edited by alasfourom; 08-01-2022 at 02:38.
alasfourom 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 20:26.


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