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

Last human ZM mode


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Fixsek Kot
Member
Join Date: Feb 2022
Old 06-26-2022 , 15:38   Last human ZM mode
Reply With Quote #1

Hi.

I've always been strugling with this particular problem: getting the count of players
I need to get number of counter terrorists in ham_killed function, and if there is only one of him, the code will continue, but getting number of counter terrorists seems to be an issue for me, I've been trying to solve this problem 2 hours I think and I just can't get over it, so I finally came here for help, and this is what my final "art" looks like:
PHP Code:
if(team(victim) == 2)
        {
            for(new 
0get_maxplayers(); i++)
            {
                new 
ct 0
                
if(team(i) == 2)
                {
                    
ct += 1
                    
return HAM_IGNORED
                
}
                if(
ct == 1)
                {
                    if(
team(i) == 2)
                    {
                        
set_user_health(i1000)
                    }
                }
                
ct 0
            
}
        } 
Thank you in advance for help. -Fixsek Kot.

Last edited by Fixsek Kot; 06-26-2022 at 15:38.
Fixsek Kot is offline
Fixsek Kot
Member
Join Date: Feb 2022
Old 06-27-2022 , 09:40   Re: Last human ZM mode
Reply With Quote #2

Hello,

I finally figured it out, so there's no need to help, if someone wants to see the right code, here:
PHP Code:
new bool:last_human
enum
{
          
zivy,
          
mrtvy
}
if(
team(victim) == 2)
        {
            if(
get_playercount(CS_TEAM_CTzivy) == 1)
            {
                new 
players[32], num
                get_players
(playersnum)
                for(new 
id 0id numid++)
                {
                    if(
team(id) == 2)
                    {
                        
set_user_health(id1000)
                        
last_human true
                    
}
                }
            }
        }
get_playercount(CsTeams:teamstatus)
{
    new 
playercount
    
for(new 0<= get_maxplayers(); i++)
    {
        if(!
is_user_connected(i) || cs_get_user_team(i) != team) continue
        switch(
status)
        {
            case 
mrtvy: if(is_user_alive(i)) continue
            case 
zivy: if(!is_user_alive(i)) continue
        }
        
playercount++
    }
    return 
playercount


Last edited by Fixsek Kot; 06-27-2022 at 09:42.
Fixsek Kot 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:22.


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