AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Detect a player join team (https://forums.alliedmods.net/showthread.php?t=65985)

Hunter-Digital 01-20-2008 18:50

Detect a player join team
 
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 :mrgreen:

Arkshine 01-20-2008 18:58

Re: Detect a player join team
 
There are several ways.

Hooking 'TxtMsg' event, 'TeamInfo' event, 'jointeam'/'joinclass' command...

Sn!ff3r 01-20-2008 19:33

Re: Detect a player join team
 
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

Hunter-Digital 01-20-2008 19:40

Re: Detect a player join team
 
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 :mrgreen:

Exolent[jNr] 01-20-2008 21:21

Re: Detect a player join team
 
wouldnt the 'TeamInfo' approach be ineffective since its used to use colored chat messages?

Alka 01-21-2008 09:42

Re: Detect a player join team
 
Yeah, would be called if you print a color message to a player. :S

Hunter-Digital 01-21-2008 09:58

Re: Detect a player join team
 
So, what do you recomend me using ? :? (ex code pls :P )

ConnorMcLeod 01-21-2008 10:33

Re: Detect a player join team
 
Quote:

Originally Posted by X-olent (Post 576458)
wouldnt the 'TeamInfo' approach be ineffective since its used to use colored chat messages?

message_begin can't be caught by other plugins.

pharse 01-21-2008 14:17

Re: Detect a player join team
 
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.

ConnorMcLeod 01-21-2008 15:47

Re: Detect a player join team
 
Have a look there : http://forums.alliedmods.net/showthread.php?t=63818


All times are GMT -4. The time now is 08:47.

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