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

Exec command ONCE after chosing a team


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DeLiriuM
Senior Member
Join Date: Dec 2006
Old 04-15-2012 , 08:21   Exec command ONCE after chosing a team
Reply With Quote #1

Hey,

I'm trying to exec a say command after a player joins the server and chooses a team.

Currently i'm using this method:

PHP Code:
public client_infochanged(id
{     
    if (
get_user_team(id) > 0client_cmd(id"say /rules")
    return 
PLUGIN_CONTINUE 

Problem is, that even if the player changes his team, the commands executes again. I need it to execute ONLY once after the first teamjoin.
__________________

Last edited by DeLiriuM; 04-15-2012 at 08:21.
DeLiriuM is offline
BeeFighter
Member
Join Date: Feb 2012
Old 04-15-2012 , 08:31   Re: Exec command ONCE after chosing a team
Reply With Quote #2

Use TextMsg event,

And to prevent from showing again when he changes team make a bool, to do a check.
__________________
www.Gstar-Gaming.net

Servers:
Jailbreak
HidenSeek
Knife
Deathrun
Public

Join us now: www.gstar-gaming.net
BeeFighter is offline
DeLiriuM
Senior Member
Join Date: Dec 2006
Old 04-15-2012 , 08:57   Re: Exec command ONCE after chosing a team
Reply With Quote #3

Ahm. Example please.
__________________
DeLiriuM is offline
BeeFighter
Member
Join Date: Feb 2012
Old 04-15-2012 , 09:02   Re: Exec command ONCE after chosing a team
Reply With Quote #4

PHP Code:
register_event("TextMsg""AtJoinTeam""a""1=1""2&Game_join_te""2&Game_join_ct")

public 
AtJoinTeam()
{
    new 
iPlayers[32], iNumtempid
    get_players
(iPlayersiNum)
        
    for(new 
iiNumi++)
    {
        
tempid iPlayers[i]
                 
        if(
MyCheck[tempid] == true)
        {
            return 
PLUGIN_HANDLED
        
}
        
        
//Your rules here
    
}

__________________
www.Gstar-Gaming.net

Servers:
Jailbreak
HidenSeek
Knife
Deathrun
Public

Join us now: www.gstar-gaming.net

Last edited by BeeFighter; 04-15-2012 at 09:03.
BeeFighter is offline
DeLiriuM
Senior Member
Join Date: Dec 2006
Old 04-15-2012 , 12:12   Re: Exec command ONCE after chosing a team
Reply With Quote #5

Still doesn't work. Command still executes after team change.
__________________
DeLiriuM is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-15-2012 , 12:48   Re: Exec command ONCE after chosing a team
Reply With Quote #6

Untested
PHP Code:
#include <amxmodx>

enum TeamSelect
{
    
None,
    
Team,
    
Model
}

new 
TeamSelect:g_tsJoinedTeam33 ];

public 
plugin_init() 
{
    
register_event"TeamInfo" "fw_EvTeamInfo" "a" );
}

public 
client_disconnectid )
{
    
g_tsJoinedTeamid ] = None;
}

public 
fw_EvTeamInfo()
{
    new 
iPlayer read_data);

    if ( 
g_tsJoinedTeamiPlayer ] < Model )
    {
        new 
szTeam];
        
read_dataszTeam charsmaxszTeam ) );
        
        switch ( 
szTeam] )
        {
            case 
'T' 'C'
            {
                if ( ++
g_tsJoinedTeamiPlayer ] == Model )
                {
                    
//Your code goes here
                
}
            }
        }    
    }

__________________

Last edited by Bugsy; 04-15-2012 at 13:39.
Bugsy is offline
DeLiriuM
Senior Member
Join Date: Dec 2006
Old 04-15-2012 , 13:19   Re: Exec command ONCE after chosing a team
Reply With Quote #7

Quote:
Originally Posted by Bugsy View Post
Untested
PHP Code:

#include <amxmodx>

new bool:g_bJoinedTeam33 ];

public 
plugin_init() 
{
    
register_event"TeamInfo" "fw_EvTeamInfo" "a" );
}

public 
client_disconnectid )
{
    
g_bJoinedTeamid ] = false;
}

public 
fw_EvTeamInfo()
{
    new 
iPlayer read_data);
    
    if ( !
g_bJoinedTeamiPlayer ] )
    {
        new 
szTeam];
        
read_dataszTeam charsmaxszTeam ) );
        
        switch ( 
szTeam] )
        {
            case 
'T' 'C'
            {
                
//Put your code here, add 'S' if you also want to hook Spectator join
                
                
g_bJoinedTeamiPlayer ] = true;
            }
        }    
    }

Works like a charm. Only problem is that it doesn't wait to choose a skin.
__________________
DeLiriuM is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-15-2012 , 13:39   Re: Exec command ONCE after chosing a team
Reply With Quote #8

Quote:
Originally Posted by DeLiriuM View Post
Works like a charm. Only problem is that it doesn't wait to choose a skin.
Edited above code.
__________________
Bugsy 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 04:52.


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