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

[REQ] [L4D2] Survivor Counter


Post New Thread Reply   
 
Thread Tools Display Modes
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 11-01-2013 , 12:33   Re: [REQ] [L4D2] Survivor Counter
Reply With Quote #11

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;

__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.
GsiX is offline
noxman
Member
Join Date: Jun 2012
Old 11-01-2013 , 12:56   Re: [REQ] [L4D2] Survivor Counter
Reply With Quote #12

Sorry but still doenst work fine. I still see "Charger died. 1 Survivors left". But, if iam die as a infected no hint message is shown.

EDIT: Does every player see the Hint Message "PLAYERNAME died. 8 Survivors left?"
noxman is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 11-01-2013 , 13:51   Re: [REQ] [L4D2] Survivor Counter
Reply With Quote #13

If you tweak the file and not willing to show the code here.. i cant help you anymore.

p/s: it show to all survivor the same message.
Attached Thumbnails
Click image for larger version

Name:	Untitled.jpg
Views:	222
Size:	90.3 KB
ID:	127370  
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.
GsiX is offline
noxman
Member
Join Date: Jun 2012
Old 11-03-2013 , 05:30   Re: [REQ] [L4D2] Survivor Counter
Reply With Quote #14

Quote:
Originally Posted by GsiX View Post
If you tweak the file and not willing to show the code here.. i cant help you anymore.

p/s: it show to all survivor the same message.
Sorry, but what do you mean with "tweak"?

No errors in the logs etc.
noxman is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 11-05-2013 , 14:57   Re: [REQ] [L4D2] Survivor Counter
Reply With Quote #15

GsiX, noxman is using another plugin who add more Survivors.
The added Survivor can't be counted with a simple team detector and message only displayed when you are a "real" Survivor (By real I mean a Survivor who are not added by this max team player plugin). Same for infected.
Maybe I'm wrong but you should edit this plugin who allow you to override max players in team.

This is what I think, I'm maybe wrong.
__________________
Want to check my plugins ?

Last edited by Arkarr; 11-05-2013 at 15:00. Reason: >more infos<
Arkarr is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 11-06-2013 , 12:46   Re: [REQ] [L4D2] Survivor Counter
Reply With Quote #16

now it make sense..

EDIT: You suggest that "MaxClients" not return the actual number?
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.

Last edited by GsiX; 11-06-2013 at 12:56.
GsiX is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 11-06-2013 , 13:05   Re: [REQ] [L4D2] Survivor Counter
Reply With Quote #17

Quote:
Originally Posted by GsiX View Post
now it make sense..

EDIT: You suggest that "MaxClients" not return the actual number?
Not sure, but only the true player (who can be dected with "GetClientTeam") will see the message. The other one ? I have no idea in wich team they are, maybe spectator ?
__________________
Want to check my plugins ?
Arkarr is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 11-06-2013 , 13:32   Re: [REQ] [L4D2] Survivor Counter
Reply With Quote #18

I m a bit confused. If the plugin unable to detect real player, then there should be no message at all instead of returning the wrong player (bot).

EDIT: The only thing i can think of is, Human player join the sever using bot name.
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.

Last edited by GsiX; 11-06-2013 at 13:34.
GsiX is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 11-06-2013 , 13:47   Re: [REQ] [L4D2] Survivor Counter
Reply With Quote #19

Quote:
Originally Posted by GsiX View Post
I m a bit confused. If the plugin unable to detect real player, then there should be no message at all instead of returning the wrong player (bot).

EDIT: The only thing i can think of is, Human player join the sever using bot name.
I think, if you want display message to correct player, you should chekc player models instend of team. There is already a function for that. "GetClientModel"
__________________
Want to check my plugins ?
Arkarr is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 11-06-2013 , 23:49   Re: [REQ] [L4D2] Survivor Counter
Reply With Quote #20

i done some test last night and seems like what you said was right after all.. When i switch team from Survivor to Infected.. the hunter keep leap on me for no reason.

in noxman case, he actually jump around between Survivor and Infected team. Cause the "GetClientTeam" to fail detect his team properly.

"GetClientModel" is the work around to this problem as what you suggested.

Thanks...
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.
GsiX 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 00:20.


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