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

cs_get_user_team and get_user_team


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GhostMan
Senior Member
Join Date: Jun 2012
Old 07-29-2012 , 14:56   cs_get_user_team and get_user_team
Reply With Quote #1

Difference between these two in CS is only that cs_get_user_team returns CS_TEAM_T, CS_TEAM_CT etc. and get_user_team returns 1,2 etc. ?

Am i right, one of them may have "bugs" in some cases, that's becouse the other one is more reliable?

Last edited by GhostMan; 07-29-2012 at 14:56.
GhostMan is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-29-2012 , 16:50   Re: cs_get_user_team and get_user_team
Reply With Quote #2

Exactly, cs_get_user_team is completely reliable.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
guipatinador
SourceMod Donner Party
Join Date: Oct 2009
Location: Poortugal
Old 07-29-2012 , 18:29   Re: cs_get_user_team and get_user_team
Reply With Quote #3

I'm doing a skillpoints plugin.
This code work,

PHP Code:
register_event"SendAudio""Terroristswin""a""2&%!MRAD_terwin" )

public 
Terroristswin( )
{
    for ( new 
1<= g_iMaxPlayersi++ )
    {        
        if( 
get_user_team) == )
        {
            
// some stuff
        
}
    }

But this code don't work,
PHP Code:
#include < cstrike >
register_event"SendAudio""Terroristswin""a""2&%!MRAD_terwin" )

public 
Terroristswin( )
{
    for ( new 
1<= g_iMaxPlayersi++ )
    {        
        if( 
cs_get_user_team) == CS_TEAM_T )
        {
            
// some stuff
        
}
    }

guipatinador is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-29-2012 , 19:05   Re: cs_get_user_team and get_user_team
Reply With Quote #4

Because you have to check if users are connected, but better to use get_players, to you get a list of already connected players and all you have to do is to check their team.

PHP Code:
public plugin_init()
{
    
register_event("SendAudio""Broadcast_terwin""a""1=0""2=%!MRAD_terwin")
}

public 
Broadcast_terwin()
{
    new 
players[32], numid
    get_players
(playersnum"h")
    for(--
numnum>=0num--)
    {
        
id playersnum ]
        if( 
cs_get_user_team(id) == CS_TEAM_T )
        {
            
// do stuff
        
}
    }

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 07-29-2012 at 19:05.
ConnorMcLeod 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 22:22.


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