Raised This Month: $ Target: $400
 0% 

Detect player


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
nikodz
Junior Member
Join Date: Jul 2009
Old 08-18-2010 , 11:07   Re: Detect player
Reply With Quote #5

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "Team Change"
#define VERSION "1.0"
#define AUTHOR "Niko"

new ter[33]
new 
cts[33]

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_logevent"eventRoundStart"2"0=World triggered""1=Round_Start" );
    
register_logevent"eventRoundEnd"2"0=World triggered""1=Round_Draw""1=Round_End" );
    
register_event"DeathMsg""eventDeathMsg""a" );
}
public 
client_connect(id){
    
ter[id]=false;
}
public 
client_disconnect(id){
    
ter[id]=false;
}
public 
eventRoundStart(){
    new 
g_Maxplayers;
    
g_Maxplayers get_maxplayers();
    
    for(new 
i=1i<=g_Maxplayersi++){
        if(
cs_get_user_team(i)==CS_TEAM_T){
            
ter[i]=true;
        }
        if(
cs_get_user_team(i)==CS_TEAM_T){
            
cts[i]=true;
        }
    }
    
    return 
PLUGIN_HANDLED;
}
public 
eventRoundEnd(){
    new 
g_Maxplayers;
    
g_Maxplayers get_maxplayers();
    
    for(new 
i=1i<=g_Maxplayersi++){
        if(
ter[i]){
            
cs_set_user_team(iCS_TEAM_CT);
            
ter[i]=false;
        }
        if(!
cts[i] && !ter[i]){
            
cs_set_user_team(iCS_TEAM_CT);
        }
    }
    
    return 
PLUGIN_HANDLED;
}
public 
eventDeathMsg(){
    new 
iKiller read_data), iVictim read_data);
    if(
cs_get_user_team(iKiller)==CS_TEAM_CT){
        
cs_set_user_team(iKillerCS_TEAM_T)
    }
    return 
PLUGIN_HANDLED;

I made this one...
If CT kill T, T moved to CT. If player join after round start he will move to CT. If player was T for round start he will move to CT when round end.
if something is wrong...
nikodz is offline
 



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 21:58.


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