Raised This Month: $ Target: $400
 0% 

Detect Jointeam


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
11922911
Senior Member
Join Date: Dec 2011
Location: Yuen Long Country
Old 05-25-2013 , 00:27   Re: Detect Jointeam
Reply With Quote #1

If you are talking about in CS, and you want detect only T/CT,
I suggest you to hook client 'joinclass' command.
Here's an example of how to detect jointeam by hooking joinclass command. (correct me if i'm wrong)
PHP Code:
#include amxmodx
#include fakemeta

#define m_iTeam 114
#define m_iMenu 205

#define CSMENU_JOINCLASS 3

public plugin_init()
{
    
register_clcmd"joinclass""ClCmd_joinclass" )
    
register_clcmd"menuselect""ClCmd_joinclass" // for old style text menu
}

public 
ClCmd_joinclassid )
{
    if( 
get_pdata_intidm_iMenu ) == CSMENU_JOINCLASS )
    {
        new 
iTeam get_pdata_intidm_iTeam // get team
        // log_amx( "Detect Jointeam [TEAM ID %d]", iTeam )
    
}

Else, you can try the following method.
PHP Code:
#include amxmodx

public plugin_init()
{
    
register_logevent"LogEvent_JoinTeam"3"1=joined team" )
}

public 
LogEvent_JoinTeam()
{
    new 
id GetLogUserIndex()
    
    static 
szTeam[2], iTeam
    read_logargv
2szTeam)
    switch( 
szTeam[0] )
    {
        case 
'T'iTeam 1;
        case 
'C'iTeam 2;
        case 
'S'iTeam 3;
    }
    
    
//log_amx( "Detect Jointeam [TEAM ID %d]", iTeam )
}

stock GetLogUserIndex()
{
    static 
szLogUser[80], szName[32]
    
read_logargv0szLogUsercharsmaxszLogUser ) )
    
parse_loguserszLogUserszNamecharsmaxszName ) )
    return 
get_user_indexszName )

For more examples, please search the forum.
11922911 is offline
piepie
Member
Join Date: May 2013
Location: Pieland *.*
Old 05-25-2013 , 05:17   Re: Detect Jointeam
Reply With Quote #2

Quote:
Originally Posted by 11922911 View Post
If you are talking about in CS, and you want detect only T/CT,
I suggest you to hook client 'joinclass' command.
Here's an example of how to detect jointeam by hooking joinclass command. (correct me if i'm wrong)
PHP Code:
#include amxmodx
#include fakemeta

#define m_iTeam 114
#define m_iMenu 205

#define CSMENU_JOINCLASS 3

public plugin_init()
{
    
register_clcmd"joinclass""ClCmd_joinclass" )
    
register_clcmd"menuselect""ClCmd_joinclass" // for old style text menu
}

public 
ClCmd_joinclassid )
{
    if( 
get_pdata_intidm_iMenu ) == CSMENU_JOINCLASS )
    {
        new 
iTeam get_pdata_intidm_iTeam // get team
        // log_amx( "Detect Jointeam [TEAM ID %d]", iTeam )
    
}

Else, you can try the following method.
PHP Code:
#include amxmodx

public plugin_init()
{
    
register_logevent"LogEvent_JoinTeam"3"1=joined team" )
}

public 
LogEvent_JoinTeam()
{
    new 
id GetLogUserIndex()
    
    static 
szTeam[2], iTeam
    read_logargv
2szTeam)
    switch( 
szTeam[0] )
    {
        case 
'T'iTeam 1;
        case 
'C'iTeam 2;
        case 
'S'iTeam 3;
    }
    
    
//log_amx( "Detect Jointeam [TEAM ID %d]", iTeam )
}

stock GetLogUserIndex()
{
    static 
szLogUser[80], szName[32]
    
read_logargv0szLogUsercharsmaxszLogUser ) )
    
parse_loguserszLogUserszNamecharsmaxszName ) )
    return 
get_user_indexszName )

For more examples, please search the forum.
What is the best way?
__________________

piepie is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-25-2013 , 07:49   Re: Detect Jointeam
Reply With Quote #3

What you want to do with join team detection ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
11922911
Senior Member
Join Date: Dec 2011
Location: Yuen Long Country
Old 05-25-2013 , 08:09   Re: Detect Jointeam
Reply With Quote #4

It depends on what you need,
if you want to accurately detect when a player selects a skin, the first one is better.
11922911 is offline
piepie
Member
Join Date: May 2013
Location: Pieland *.*
Old 05-25-2013 , 08:47   Re: Detect Jointeam
Reply With Quote #5

Quote:
Originally Posted by ConnorMcLeod View Post
What you want to do with join team detection ?
Quote:
Originally Posted by 11922911 View Post
It depends on what you need,
if you want to accurately detect when a player selects a skin, the first one is better.
When user joins a team (only T or CT) i want to set a task to function.
__________________


Last edited by piepie; 05-25-2013 at 08:50.
piepie 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 16:18.


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