AlliedModders

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

Caldeum 08-27-2012 06:01

get user old team
 
How to get user old team?

if i join the server and choose one of the team i must get message but if i change team do not show message for me.

PHP Code:

if ( iTeam != Oldteam... ) 

PHP Code:

    new CsTeams:iTeam cs_get_user_teamid );
    
    if ( 
iTeam != CS_TEAM_T && iTeam != CS_TEAM_CT )
    {
       
//message
    



jimaway 08-27-2012 15:27

Re: get user old team
 
hook jointeam command and check cs_get_user_team there

also your part of code will still show the message if player switches to team from spectating, check if users team is CS_TEAM_UNASSIGNED for it to work only after connecting

Caldeum 08-27-2012 15:54

Re: get user old team
 
jointeam hooked.

is it right? :)
PHP Code:

    new CsTeams:iTeam cs_get_user_teamid );
    
    if ( 
iTeam == CS_TEAM_T || iTeam == CS_TEAM_CT && cs_get_user_teamid ) == CS_TEAM_UNASSIGNED 


YamiKaitou 08-27-2012 16:38

Re: get user old team
 
That statement will always evaluate to false

jimaway 08-27-2012 16:48

Re: get user old team
 
if (cs_get_user_team( id ) == CS_TEAM_UNASSIGNED )

Caldeum 08-27-2012 17:01

Re: get user old team
 
Ok. But if i'm in CT and i change my team to T i will get the //message. What i'm trying to do is block message if i change my team but show message when i connect and choose the team.

bibu 08-27-2012 17:04

Re: get user old team
 
http://forums.alliedmods.net/showpos...21&postcount=3

claudiuhks 08-27-2012 22:58

Re: get user old team
 
If this is not enough, you may try do this:

PHP Code:

#include < amxmodx >
#include < fakemeta >

new g_iTeam33 ], Floatg_fTimeg_iMaxClientsboolg_bConnected33 ];

public 
client_connectiPlayer ) {
  
g_iTeamiPlayer ] = -1;
  
g_bConnectediPlayer ] = false;
}

public 
client_disconnectiPlayer ) {
  
g_iTeamiPlayer ] = -1;
  
g_bConnectediPlayer ] = false;
}

public 
plugin_init( ) {
  
register_forwardFM_StartFrame"OnGameFrame" );
  
g_iMaxClients get_maxplayers( );
}

public 
client_putinserveriPlayer )
  
g_bConnectediPlayer ] = true;

public 
OnGameFrame( ) {
  static 
FloatfGameTimeiiTeam;
  
fGameTime get_gametime( );

  if( 
fGameTime g_fTime >= 0.0666 ) {
    for( 
1<= g_iMaxClientsi++ ) {
      if( 
g_bConnected] ) {
        
iTeam get_pdata_inti114 );

        if( 
g_iTeam] != iTeam ) {
          
// THE TEAM HAS BEEN CHANGED ( OLDTEAM = g_iTeam[ i ], NEWTEAM = iTeam )

          /*

          */

          
g_iTeam] = iTeam;
        }
      }
    }

    
g_fTime fGameTime;
  }



jimaway 08-28-2012 05:08

Re: get user old team
 
Quote:

Originally Posted by Caldeum (Post 1784510)
Ok. But if i'm in CT and i change my team to T i will get the //message. What i'm trying to do is block message if i change my team but show message when i connect and choose the team.

you don't even know what you're talking about, don't you?

i dont get you all with your bigass codes with 1000000 variables cacheing teams and shit

Code:
#include <amxmodx> #include <cstrike> public plugin_init() {     register_plugin("this", "0", "jimaway")     register_clcmd("jointeam", "jointeam_func") } public jointeam_func(id) {     if (cs_get_user_team(id) == CS_TEAM_UNASSIGNED) {         //message     } }

Caldeum 08-28-2012 05:24

Re: get user old team
 
Check this code in your server and join to CT after change team to T.


All times are GMT -4. The time now is 05:50.

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