Raised This Month: $ Target: $400
 0% 

set health


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GhostMan
Senior Member
Join Date: Jun 2012
Old 07-14-2012 , 14:32   set health
Reply With Quote #1

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

Last edited by GhostMan; 07-14-2012 at 14:32.
GhostMan is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-14-2012 , 14:39   Re: set health
Reply With Quote #2

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)
    } 
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 07-14-2012 , 19:06   Re: set health
Reply With Quote #3

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.
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-14-2012 , 19:49   Re: set health
Reply With Quote #4

Quote:
Originally Posted by Liverwiz View Post
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.
__________________
fysiks is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-14-2012 , 20:39   Re: set health
Reply With Quote #5

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.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-14-2012 , 21:15   Re: set health
Reply With Quote #6

Quote:
Originally Posted by ConnorMcLeod View Post
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.
__________________
fysiks 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 15:22.


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