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

[L4D] How to determine Team Infected victory


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
muukis
Veteran Member
Join Date: Apr 2009
Old 10-03-2009 , 11:35   [L4D] How to determine Team Infected victory
Reply With Quote #1

The subject says it all... How to determine if all players (including computer controlled players) on Team Survivors are dead or incapacitated? Is there an easy way or do I have to crawl through all players and look for the status?
muukis is offline
Frus
Senior Member
Join Date: Aug 2009
Old 10-03-2009 , 12:16   Re: [L4D] How to determine Team Infected victory
Reply With Quote #2

Well, there is a mission_lost event, but I don't know if it fires in vs.

I would just loop through the survivors checking their status on round_end, here's a function to do that.

Remember that round_end fires multiple times, it's not necessarily only when the score screen pops up, it seems to fire twice in between round 1 and round 2 on a map.

PHP Code:
public AreAllSurvivorsDead()
{
    new 
IncapOffset GetEntSendPropOffs("CTerrorPlayer""m_isIncapacitated");
    for (new 
i=1;i<MaxClients;i++)
        if (
IsClientInGame(i) && GetClientTeam(i) == && IsPlayerAlive(i) && GetEntData(iIncapOffset) == 0)
            return 
false;
    return 
true;

And the scripting forum is for questions, this is for posting code etc. ;)

Last edited by Frus; 10-03-2009 at 12:23.
Frus is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 10-11-2009 , 12:55   Re: [L4D] How to determine Team Infected victory
Reply With Quote #3

i <= MaxClients.
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami 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 12:10.


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