Raised This Month: $75 Target: $400
 18% 

Solved count mobs l4d


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alexmy
Senior Member
Join Date: Oct 2014
Location: Russian Federation, Omsk
Old 05-20-2019 , 11:59   count mobs l4d
Reply With Quote #1

Hi, I'm trying to count the number of live mobs. But I do not like it. Since Mobs does not have m_zombieClass.

PHP Code:
int IsPanicMobsAlive()
{
    
int count 0;
    for (
int i 1<= MaxClientsi++)
        if (
IsClientConnected(i) && IsClientInGame(i) && IsFakeClient(i) && GetEntProp(iProp_Send"m_zombieClass") == 0count++;
    return 
count;

Does anyone have an option how to count live mobs

Last edited by Alexmy; 05-22-2019 at 17:43.
Alexmy is offline
farawayf
Senior Member
Join Date: Jan 2019
Old 05-20-2019 , 12:48   Re: count mobs l4d
Reply With Quote #2

i dont know why you trying to check m_zombieClass on bots, because you wrote that you want to count all.
would not it be easier to do like this ?

PHP Code:

int IsPanicMobsAlive
() 

    
int count 0
    for (
int i 1<= MaxClientsi++) 
        if (
IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && IsFakeClient(i) && GetClientTeam(i) == 3count++; 
    return 
count


Last edited by farawayf; 05-20-2019 at 12:50.
farawayf is offline
Alexmy
Senior Member
Join Date: Oct 2014
Location: Russian Federation, Omsk
Old 05-20-2019 , 12:57   Re: count mobs l4d
Reply With Quote #3

Quote:
Originally Posted by farawayf View Post
i dont know why you trying to check m_zombieClass on bots, because you wrote that you want to count all.
would not it be easier to do like this ?

PHP Code:

int IsPanicMobsAlive
() 

    
int count 0
    for (
int i 1<= MaxClientsi++) 
        if (
IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && IsFakeClient(i) && GetClientTeam(i) == 3count++; 
    return 
count

If use GetClientTeam(i) == 3. Mobs will be considered this way.?
Alexmy is offline
farawayf
Senior Member
Join Date: Jan 2019
Old 05-20-2019 , 13:21   Re: count mobs l4d
Reply With Quote #4

as far as i know "3" is a infected team, so i think yes it will.
farawayf is offline
Alexmy
Senior Member
Join Date: Oct 2014
Location: Russian Federation, Omsk
Old 05-20-2019 , 13:49   Re: count mobs l4d
Reply With Quote #5

Quote:
Originally Posted by farawayf View Post
as far as i know "3" is a infected team, so i think yes it will.
No, it doesn't work, I tried the code does not work.

PHP Code:
if(IsPanicMobsAlive() >= 5)        
        {
            
PrintHintText(client"Да Подожди Ты %N Запускать Генератор, Мобов много: %s."clientIsPanicMobsAlive());
            return 
Plugin_Handled;
        }
    }
    return 
Plugin_Continue;


int IsPanicMobsAlive() 

    
int count 0
    for (
int i 1<= MaxClientsi++) 
        if (
IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && IsFakeClient(i) && GetClientTeam(i) == 3count++; 
    return 
count

Alexmy is offline
Silvers
AlliedModders Donor
Join Date: Aug 2010
Location: SpaceX
Old 05-20-2019 , 13:56   Re: count mobs l4d
Reply With Quote #6

What do you mean "Mobs"? Common Infected? They are not client entities like Special Infected which use m_zombieClass. You want to count common infected during a panic event? Then you have to find and count the number of "infected" classes.
__________________
Silvers is offline
Alexmy
Senior Member
Join Date: Oct 2014
Location: Russian Federation, Omsk
Old 05-20-2019 , 14:04   Re: count mobs l4d
Reply With Quote #7

Quote:
Originally Posted by Silvers View Post
What do you mean "Mobs"? Common Infected? They are not client entities like Special Infected which use m_zombieClass. You want to count common infected during a panic event? Then you have to find and count the number of "infected" classes.
I'm interested in Common Infected. How can I do it?
Alexmy is offline
Silvers
AlliedModders Donor
Join Date: Aug 2010
Location: SpaceX
Old 05-20-2019 , 14:07   Re: count mobs l4d
Reply With Quote #8

PHP Code:
int common = -1;
while( (
common FindEntityByClassname(common"infected")) != INVALID_ENT_REFERENCE )
    
numCommon++; 
__________________

Last edited by Silvers; 05-20-2019 at 14:07.
Silvers is offline
Alexmy
Senior Member
Join Date: Oct 2014
Location: Russian Federation, Omsk
Old 05-20-2019 , 16:56   Re: count mobs l4d
Reply With Quote #9

Quote:
Originally Posted by Silvers View Post
PHP Code:
int common = -1;
while( (
common FindEntityByClassname(common"infected")) != INVALID_ENT_REFERENCE )
    
numCommon++; 
Thank you very much, it really works. =)
Alexmy 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 09:54.


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