Raised This Month: $ Target: $400
 0% 

check alive players from a team problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Owyn
Veteran Member
Join Date: Nov 2007
Old 04-06-2009 , 15:40   Re: check alive players from a team problem
Reply With Quote #1

it didn't help anyway, btw, why do i get a tag mismatch at
PHP Code:
if ( cs_get_user_team(i) == 
?
__________________
☜ Free Mozy ☂backup\҉sync user
Quote:
Американский форум - Задаёшь вопрос, потом тебе отвечают.
Израильский форум - Задаёшь вопрос, потом тебе задают вопрос.
Русский форум - Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.
Owyn is offline
Send a message via ICQ to Owyn
IneedHelp
Veteran Member
Join Date: Mar 2007
Location: Argentina
Old 04-06-2009 , 15:44   Re: check alive players from a team problem
Reply With Quote #2

try with CS_TEAM_T

Also, you can optimize your checkalive function doing only 1 loop
__________________
IneedHelp is offline
Owyn
Veteran Member
Join Date: Nov 2007
Old 04-06-2009 , 15:48   Re: check alive players from a team problem
Reply With Quote #3

Quote:
Originally Posted by IneedHelp View Post
try with CS_TEAM_T

Also, you can optimize your checkalive function doing only 1 loop
hmm, worked, but i've seen "cs_get_user_team(i) != 1" construction in public rulez plugin and it didn't give tag mismatch O_o

about only 1 loop, doesn't it "break" the loop with my code when it finds dead player in the team?

__________________
☜ Free Mozy ☂backup\҉sync user
Quote:
Американский форум - Задаёшь вопрос, потом тебе отвечают.
Израильский форум - Задаёшь вопрос, потом тебе задают вопрос.
Русский форум - Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.
Owyn is offline
Send a message via ICQ to Owyn
Old 04-06-2009, 15:53
vato loco [GE-S]
This message has been deleted by vato loco [GE-S]. Reason: ...
Owyn
Veteran Member
Join Date: Nov 2007
Old 04-06-2009 , 16:26   Re: check alive players from a team problem
Reply With Quote #5

PHP Code:
public soundCTWin() 
{
checkAlive("CT")
}

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

checkAlive(const team[])
{

    new 
players[32], iTotalPlayersibool:g_event true
    get_players
playersiTotalPlayers );
    
    if ( 
equaliteam"CT") )
    {
        for ( 
0iTotalPlayersi++ )
            {   
                if( !
is_user_connected(i) ) continue;
                
                if ( !
is_user_alive(i) && g_died[i] && cs_get_user_team(i) == CS_TEAM_CT )
                    {
                        
g_event false
                        
break
                    }
            }
    }
    
    if ( 
equaliteam"TE") )
    {
        for ( 
0iTotalPlayersi++ )
            {            
                if( !
is_user_connected(i) ) continue;
                
                if ( !
is_user_alive(i) && g_died[i] && cs_get_user_team(i) == CS_TEAM_T )
                    {
                        
g_event false
                        
break
                    }
            }
    }

    if (
g_event)
    {
        
set_task(1.5"doevent"team[0])
    }
    
    return 
1

now it doesn't crush but doesn't set the task =\ what is my mistake?
__________________
☜ Free Mozy ☂backup\҉sync user
Quote:
Американский форум - Задаёшь вопрос, потом тебе отвечают.
Израильский форум - Задаёшь вопрос, потом тебе задают вопрос.
Русский форум - Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.

Last edited by Owyn; 04-06-2009 at 17:50.
Owyn is offline
Send a message via ICQ to Owyn
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-06-2009 , 16:32   Re: check alive players from a team problem
Reply With Quote #6

g_event is always false (g_event isn't really global btw, i.e. "g_" is misleading)

use else if between the two discrete cases.
__________________
fysiks is offline
Owyn
Veteran Member
Join Date: Nov 2007
Old 04-06-2009 , 16:34   Re: check alive players from a team problem
Reply With Quote #7

Quote:
g_event is always false
why? it sets it to false only when it find not alive player who died and has specific team or what i did wrong with these checks to be invalid?
__________________
☜ Free Mozy ☂backup\҉sync user
Quote:
Американский форум - Задаёшь вопрос, потом тебе отвечают.
Израильский форум - Задаёшь вопрос, потом тебе задают вопрос.
Русский форум - Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.
Owyn is offline
Send a message via ICQ to Owyn
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-06-2009 , 16:37   Re: check alive players from a team problem
Reply With Quote #8

I guess I was just stating the obvious which wasn't my intention but I have no way of testing this. Nor will I.
__________________
fysiks is offline
Owyn
Veteran Member
Join Date: Nov 2007
Old 04-06-2009 , 16:39   Re: check alive players from a team problem
Reply With Quote #9

Quote:
Originally Posted by fysiks View Post
I guess I was just stating the obvious which wasn't my intention but I have no way of testing this. Nor will I.
you don't have to test it, i tell you this doesn't work and you say it is obvious and i say i still don't get it =\
__________________
☜ Free Mozy ☂backup\҉sync user
Quote:
Американский форум - Задаёшь вопрос, потом тебе отвечают.
Израильский форум - Задаёшь вопрос, потом тебе задают вопрос.
Русский форум - Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.
Owyn is offline
Send a message via ICQ to Owyn
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 04-06-2009 , 17:32   Re: check alive players from a team problem
Reply With Quote #10

You don't need to check !is_user_alive(i), you already have g_died[i], so just check if g_died[i] is true.
But that's not what preventing the code from working, the code should work. Post the setFlawlessVictory function.

EDIT: Hmm shouldn't it be:
PHP Code:
register_event("SendAudio","soundCTWin","a","2=%!MRAD_ctwin");
register_event("SendAudio","soundTWin","a","2=%!MRAD_terwin");

--->

register_event("SendAudio","soundCTWin","a","2&%!MRAD_ctwin");
register_event("SendAudio","soundTWin","a","2&%!MRAD_terwin"); 
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ

Last edited by Dores; 04-06-2009 at 17:35.
Dores 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 02:18.


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