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

[L4D] Checking if any clients are tank


Post New Thread Reply   
 
Thread Tools Display Modes
AtomicStryker
Veteran Member
Join Date: Apr 2009
Location: Teutonia!!
Old 09-13-2009 , 16:51   Re: [L4D] Checking if any clients are tank
Reply With Quote #11

Use player_death and check for the tank model. I scrapped tank_death for randomly firing twice or not at all.
AtomicStryker is offline
Dragonshadow
BANNED
Join Date: Jun 2008
Old 09-13-2009 , 17:18   Re: [L4D] Checking if any clients are tank
Reply With Quote #12

So hooking player_spawn this should work:

PHP Code:
public tankspawn(Handle:event, const String:name[], bool:dontBroadcast)
{
//   Are we enabled? If not then don't do anything
    
if(enablehook)
    {
    
//  Oh hey we're enabled! Grab the userid of the newly spawned tank
        
new client GetClientOfUserId(GetEventInt(event"userid"));
    
//  Iterate through everyone
        
for (new i=1i<=MaxClientsi++)
        {        
        
//  Are the clients on infected?
            
if (GetClientTeam(i) == 3)
            {
            
//  Yup, now check the model
                
new String:class[100];
                
GetClientModel(i, class, sizeof(class));
            
//  Is it the tank model?
                
if (StrContains(class, "tank"false) != -1)
                {
                
//  Is there already a tank alive?
                    
switch(tanklive)
                    {
                    case 
0:
                        {
                        
//  Nope no tank yet, gotta calculate his new hp!
                            
CreateTimer(0.1HUZZAHclient);
                        }
                    case 
1:
                        {
                         
//uhh tank is alive
                         //no idea what im gonna do here yet
                        
}
                    }
                }
            }
        }
    }

Dragonshadow is offline
olj
Veteran Member
Join Date: Jun 2009
Old 09-14-2009 , 05:09   Re: [L4D] Checking if any clients are tank
Reply With Quote #13

m_zombieClass 5 - as far as i know its a tank class.

tank_death should be fired whenever tank got frustrated, if im not mistaken. But you should check this yourself to be sure.
__________________
olj is offline
AtomicStryker
Veteran Member
Join Date: Apr 2009
Location: Teutonia!!
Old 09-14-2009 , 05:46   Re: [L4D] Checking if any clients are tank
Reply With Quote #14

Two little fixes, one of which will make this actually work

PHP Code:
public tankspawn(Handle:event, const String:name[], bool:dontBroadcast)
{
//   Are we enabled? If not then don't do anything
    
if(enablehook)
    {
    
//  Oh hey we're enabled! Grab the userid of the newly spawned tank
        
new client GetClientOfUserId(GetEventInt(event"userid"));
    
//  Iterate through everyone
        
for (new i=1i<=MaxClientsi++)
        {        
        
//  Are the clients on infected?
            
if (GetClientTeam(i) == 3)
            {
            
//  Yup, now check the model
                //new String:class[100];
                
decl String:class[100];
                
GetClientModel(i, class, sizeof(class));
            
//  Is it the tank model?
                //if (StrContains(class, "tank", false) != -1)
                
if (StrEqual(class, "hulk"))
                {
                
//  Is there already a tank alive?
                    
switch(tanklive)
                    {
                    case 
0:
                        {
                        
//  Nope no tank yet, gotta calculate his new hp!
                            
CreateTimer(0.1HUZZAHclient);
                        }
                    case 
1:
                        {
                         
//uhh tank is alive
                         //no idea what im gonna do here yet
                        
}
                    }
                }
            }
        }
    }

AtomicStryker is offline
Frus
Senior Member
Join Date: Aug 2009
Old 09-14-2009 , 08:50   Re: [L4D] Checking if any clients are tank
Reply With Quote #15

As olj mentioned, GetEntProp(client, Prop_Send, "m_zombieClass") == 5 is a better solution than checking the client model.

EDIT: You may also want to check IsPlayerAlive(i) in addition to being on team 3. And if you don't throw a IsClientInGame(i)/IsClientConnected(i) before GetClientTeam, I think you would get some errors.

tank_spawn event actually works fine, it just fires every time the tank switches control to another player.

Last edited by Frus; 09-14-2009 at 08:55.
Frus is offline
Dragonshadow
BANNED
Join Date: Jun 2008
Old 09-14-2009 , 12:04   Re: [L4D] Checking if any clients are tank
Reply With Quote #16

Noone confirmed that 5 is actually the tanks zombie class and I don't have time to check it so for now I'm using the model detection
Dragonshadow is offline
AtomicStryker
Veteran Member
Join Date: Apr 2009
Location: Teutonia!!
Old 09-14-2009 , 12:48   Re: [L4D] Checking if any clients are tank
Reply With Quote #17

PrintToChatAll("My m_zombieclass: %i", GetEntProp(client, Prop_Send, "m_zombieClass"));
AtomicStryker is offline
Dragonshadow
BANNED
Join Date: Jun 2008
Old 09-14-2009 , 13:33   Re: [L4D] Checking if any clients are tank
Reply With Quote #18

Quote:
Originally Posted by AtomicStryker View Post
PrintToChatAll("My m_zombieclass: %i", GetEntProp(client, Prop_Send, "m_zombieClass"));
Quote:
Originally Posted by Dragonshadow View Post
and I don't have time to check
>.>
Dragonshadow is offline
Frus
Senior Member
Join Date: Aug 2009
Old 09-14-2009 , 15:05   Re: [L4D] Checking if any clients are tank
Reply With Quote #19

Quote:
Originally Posted by Dragonshadow View Post
Noone confirmed that 5 is actually the tanks zombie class and I don't have time to check it so for now I'm using the model detection
It is 5, I've been using it in my plugins for a little while now.

iirc 1-3 are the 3 SI, 4 might be the witch, 0 might be common, but 4 and 0 are just guesses.
Frus is offline
Flynn
Senior Member
Join Date: Sep 2009
Old 09-14-2009 , 15:18   Re: [L4D] Checking if any clients are tank
Reply With Quote #20

It strikes me DragonShadow is having an 'I-can't-use-that-suggestion-because-it-has-a-trival-little-fault' complex.

I have those too. Although if you were only ever going to use yer own idea, why even bother posting on this forum?
Flynn is offline
Send a message via MSN to Flynn Send a message via Skype™ to Flynn
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 06:48.


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