AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   set health (https://forums.alliedmods.net/showthread.php?t=190075)

GhostMan 07-14-2012 14:32

set health
 
PHP Code:

new iPlayers[32], TNumCTNum

get_players
iPlayersTNum"aeh""TERRORIST" );
get_playersiPlayersCTNum"aeh""CT" );

new 
players[32], numtid
get_players
(playersnum"a")

for( new 
0numi++ )
{
    
tid players[i]
                    
    switch(
cs_get_user_team(tid))
    {
        case 
CS_TEAM_T:
        {
            
set_user_health(tid1000 CTNum 300)
        }
                        
        case 
CS_TEAM_CT:
        {
            
set_user_health(tid100 TNum 15)
        }
    }


Is there simplier way to set health for ct's & t's than this one? I guess i used to many "get_players" :O

ConnorMcLeod 07-14-2012 14:39

Re: set health
 
PHP Code:

    new iTerrorists[32], iCTs[32], CTNumTNumi
    
    get_players
iTerroristsTNum"ae""TERRORIST" )
    
get_playersiCTsCTNum"ae""CT" )

    for( 
i=0i<TNumi++ )
    {
        
set_user_health(iTerrorists[i], 1000 CTNum 300)
    }

    for( 
i=0i<CTNumi++ )
    {
        
set_user_health(iCTs[i], 100 TNum 15)
    } 


Liverwiz 07-14-2012 19:06

Re: set health
 
I want to note that i have had problems getting specific teams through get_players
I still don't know why...but it was fixed checking each player's team individually. You may not have this problem. I don't always.

fysiks 07-14-2012 19:49

Re: set health
 
Quote:

Originally Posted by Liverwiz (Post 1750494)
I want to note that i have had problems getting specific teams through get_players
I still don't know why...but it was fixed checking each player's team individually. You may not have this problem. I don't always.

There is a known bug with get_players() when using the team flag. There is a fix in the bug system but nobody that has access seems to care about AMX Mod X anymore.

ConnorMcLeod 07-14-2012 20:39

Re: set health
 
There is no problem with team flag when you combinate it with alive flag.
Problem is with dead players, if a player is changing his team when he is already dead.

fysiks 07-14-2012 21:15

Re: set health
 
Quote:

Originally Posted by ConnorMcLeod (Post 1750540)
There is no problem with team flag when you combinate it with alive flag.
Problem is with dead players, if a player is changing his team when he is already dead.

Oh, I guess I didn't remember that part. Either way, my statement still stands.


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

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