AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get team (https://forums.alliedmods.net/showthread.php?t=217528)

piepie 06-03-2013 19:14

get team
 
what is the best method? cs_get_user_team or get_user_team?

guipatinador 06-03-2013 19:19

Re: get team
 
cs_get_user_team( ) returns CS_TEAM_T, CS_TEAM_CT etc etc and get_user_team( ) returns 1, 2, etc

With get_user_team( ) you can get the team name (string).

fysiks 06-03-2013 19:52

Re: get team
 
Quote:

Originally Posted by piepie (Post 1964026)
what is the best method? cs_get_user_team or get_user_team?

Generally, cs specific functions should be used when possible for Counter-Strike.

Bos93 06-03-2013 20:21

Re: get team
 
get_user_team not properly validate command for dead players

cs_get_user_team - working correctly

xPez 06-04-2013 01:15

Re: get team
 
PHP Code:

cs_get_user_team 


TheDS1337 06-04-2013 04:50

Re: get team
 
use get_user_team( ), if u don't want to use cstrike module

hornet 06-04-2013 10:42

Re: get team
 
Quote:

Originally Posted by DeagLe.Studio (Post 1964212)
use get_user_team( ), if u don't want to use cstrike module

Not really a valid reason. Fysiks is right.

fysiks 06-05-2013 03:56

Re: get team
 
Quote:

Originally Posted by DeagLe.Studio (Post 1964212)
use get_user_team( ), if u don't want to use cstrike module

cstrike module should be used when possible.

claudiuhks 06-05-2013 06:10

Re: get team
 
Quote:

Originally Posted by guipatinador (Post 1964030)
With get_user_team( ) you can get the team name (string).

Not a problem.

PHP Code:

_get_client_teamIndexTeam[ ], Length )
{
  if( !
is_user_connectedIndex ) )
    return -
1;

  static const 
TeamNames[ ][ ] = { "UNASSIGNED""TERRORIST""CT""SPECTATOR" };
  static 
Team;

  
Team cs_get_user_teamIndex );

  if( 
Length )
    
formatexTeamLength"%s"TeamNamesTeam ] );

  return 
Team;


PHP Code:

// Returns the Counter-Strike purely team index
native cs_get_user_teamClient );

// Returns the team that is retrieved through different events like TeamInfo or ScoreInfo
native get_user_teamClientTeam[ ] = ""Length ); 

In my opinion, the best solution is retrieving the client's team index by cs_get_user_team.

Fake Meta fast conversion:

PHP Code:

_get_client_teamIndex )
{
  static const 
OFFSET_CSTEAMS 114;

  return 
is_user_connectedIndex ) ? get_pdata_intIndexOFFSET_CSTEAMS ) : -1;
}

_set_client_teamIndexTeam )
{
  static const 
OFFSET_CSTEAMS 114;

  return 
is_user_connectedIndex ) ? set_pdata_intIndexOFFSET_CSTEAMSTeam ) : -1;




All times are GMT -4. The time now is 16:23.

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