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

Detect a player join team


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 01-20-2008 , 18:50   Detect a player join team
Reply With Quote #1

I searched the entire forum for this but found absolutly nothing , so, how is it possible to detect when a player joins a team ?

I need this to spawn a player when he joins, a round will last some time (30mins or so) and if a player joins in time, spawn him I have the spawn function, just need the detection

PS: for utmod
__________________
Hunter-Digital is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-20-2008 , 18:58   Re: Detect a player join team
Reply With Quote #2

There are several ways.

Hooking 'TxtMsg' event, 'TeamInfo' event, 'jointeam'/'joinclass' command...
__________________
Arkshine is offline
Sn!ff3r
Veteran Member
Join Date: Aug 2007
Location: Poland
Old 01-20-2008 , 19:33   Re: Detect a player join team
Reply With Quote #3

PHP Code:
#include <amxmodx>

#define PLUGIN "Team join info"
#define VERSION "1.0"
#define AUTHOR "AMXX Community"


public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event"TeamInfo""join_team""a")
}


public 
join_team()
{    
    new 
id read_data(1)
    static 
user_team[32]
    
    
read_data(2user_team31)    
    
    if(!
is_user_connected(id))
        return 
PLUGIN_CONTINUE    
    
    
switch(user_team[0])
    {
        case 
'C':  
        {
            
// player join to ct's        
        
}
            
        case 
'T'
        {
            
// player join to terrorist
        
}
        
        
        case 
'S':  
        {
            
// player join to spectators
        
}
        
        
    }
    return 
PLUGIN_CONTINUE
    

http://wiki.alliedmods.net/Half-Life...vents#TeamInfo
Sn!ff3r is offline
Send a message via Skype™ to Sn!ff3r
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 01-20-2008 , 19:40   Re: Detect a player join team
Reply With Quote #4

Thank you verry much, you solved 2 of my problems with the link, I saw there the TeamScore event.... that witch I forgot where I'ved seen it
__________________
Hunter-Digital is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-20-2008 , 21:21   Re: Detect a player join team
Reply With Quote #5

wouldnt the 'TeamInfo' approach be ineffective since its used to use colored chat messages?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 01-21-2008 , 09:42   Re: Detect a player join team
Reply With Quote #6

Yeah, would be called if you print a color message to a player. :S
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 01-21-2008 , 09:58   Re: Detect a player join team
Reply With Quote #7

So, what do you recomend me using ? (ex code pls )
__________________
Hunter-Digital is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-21-2008 , 10:33   Re: Detect a player join team
Reply With Quote #8

Quote:
Originally Posted by X-olent View Post
wouldnt the 'TeamInfo' approach be ineffective since its used to use colored chat messages?
message_begin can't be caught by other plugins.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
pharse
Senior Member
Join Date: Jan 2008
Location: Germany, BW
Old 01-21-2008 , 14:17   Re: Detect a player join team
Reply With Quote #9

PHP Code:
#include <amxmodx>

public plugin_init(){
    
    
register_event("TextMsg""EVENT_PlayerJoinCT""b""2&#Game_join_ct");
}

public 
EVENT_PlayerJoinCT(id){
    
    
// your code here

The second parameter contains the TextMsg. for joining purpose there are:
#Game_join_terrorist
#Game_join_ct


NOTE: That function will be called everytime a player changes the team to CT. No matter if he just connected, is alive etc. Put in your own checks.
__________________
pharse is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-21-2008 , 15:47   Re: Detect a player join team
Reply With Quote #10

Have a look there : http://forums.alliedmods.net/showthread.php?t=63818
__________________
- tired and retired -

- my plugins -
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 12:25.


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