AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to detect (https://forums.alliedmods.net/showthread.php?t=100431)

vermillioN25 08-14-2009 14:09

How to detect
 
How do I detect if have a Last T alive?

This is for Last Request system, for JailBreak.

ConnorMcLeod 08-14-2009 14:20

Re: How to detect
 
Open miscstats.sma and look how it is coded.

VMAN 08-14-2009 18:55

Re: How to detect
 
The method I used probably isn't the best, but I used get_players and looped through alive T's and counted them. If it was 1 T, it would compare the ID with the person who typed the command.

Hope this helps

alan_el_more 08-14-2009 19:14

Re: How to detect
 
PHP Code:

new iPlayers[32], iT
get_players
(iPlayersiT"ae""TERRORIST")
if(
iT == 1)
{
        
//...
 



Jon 08-14-2009 19:14

Re: How to detect
 
Quote:

Originally Posted by VMAN (Post 900362)
The method I used probably isn't the best, but I used get_players and looped through alive T's and counted them. If it was 1 T, it would compare the ID with the person who typed the command.

Hope this helps

Why not use the flags and only retrive alive terrorists and check if the num is 1?

PHP Code:

// hns.sma
new iPlayers32 ], iNum;
get_playersiPlayersiNum"ae""TERRORIST" );
            
if( 
iNum == )
{
    
// ....



alan_el_more 08-14-2009 19:15

Re: How to detect
 
First hahaha :D

VMAN 08-14-2009 19:36

Re: How to detect
 
@Jon: The way you showed is how I do it

Bad_Bud 08-14-2009 20:49

Re: How to detect
 
You could call a function on each player death that subtracts from a total team players number for terrorists, then you'd know immediately when only one is left..?

Assuming they can't join in the middle of a round.


All times are GMT -4. The time now is 15:08.

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