Raised This Month: $ Target: $400
 0% 

check alive players from a team problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Owyn
Veteran Member
Join Date: Nov 2007
Old 04-06-2009 , 13:07   check alive players from a team problem
Reply With Quote #1

PHP Code:
new bool:g_died[33]

public 
plugin_init()
{
register_event"DeathMsg"  "on_DeathMsg"  "a"  );
register_event("SendAudio","soundCTWin","a","2=%!MRAD_ctwin");
register_event("SendAudio","soundTWin","a","2=%!MRAD_terwin");
}


public 
on_DeathiVictimiAttackeriWeaponIDiHeadshot )
{
g_died[iVictim] = true
}

public 
soundCTWin() 
{
checkAlive("CT")
}

public 
soundTWin() 
{
checkAlive("TERRORIST")
}

checkAlive(const team[])
{

    new 
players[32], playerNumbool:g_event true
    get_players
(playersplayerNum"e"team)
    
    for (new 
0playerNumi++)
    {
        if (!
is_user_alive(players[i]) && g_died[players[i]])
        {
            
g_event false

            
break
        }
    }

    for (new 
6<= get_maxplayers(); i++)
        if (
g_event && is_user_connected(i))
            
set_task(1.5"doevent"team[0])
    
    return 
1

sometimes it works like it should but sometimes it doesn't, and sets task "doevent" even if players from both team died but it should only if all players from team checked by checkAlive() are alive
__________________
☜ Free Mozy ☂backup\҉sync user
Quote:
Американский форум - Задаёшь вопрос, потом тебе отвечают.
Израильский форум - Задаёшь вопрос, потом тебе задают вопрос.
Русский форум - Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.
Owyn is offline
Send a message via ICQ to Owyn
 



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 02:18.


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