Raised This Month: $ Target: $400
 0% 

Detect player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Vechta
Veteran Member
Join Date: Jun 2010
Old 08-18-2010 , 08:27   Detect player
Reply With Quote #1

I want to make,
if player is in counter-terrosist team and he die he change to terrorist team (Already maked) but if new round start the people who was in ct team and died changed to terrorist team ... (Sorry for my awesome english )
Vechta is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 08-18-2010 , 10:28   Re: Detect player
Reply With Quote #2

Could you clarify?

What I got from that is

If someone dies and are on CT, then they change to T. Then on the next round start they switch?????????????
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
Vechta
Veteran Member
Join Date: Jun 2010
Old 08-18-2010 , 10:29   Re: Detect player
Reply With Quote #3

yes.., but if player was terrorist they change to ct team on new round the old cts doesnt change team
Vechta is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 08-18-2010 , 10:40   Re: Detect player
Reply With Quote #4

Maybe register the event_deathmsg and then if the player is on T when he dies, change him to CT and if he is CT and he dies, change him to T?

Also, make sure mp_autoteambalance is 0
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
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
Vechta
Veteran Member
Join Date: Jun 2010
Old 08-18-2010 , 11:14   Re: Detect player
Reply With Quote #6

I think that is what i need

thanks i will test later^^
Vechta is offline
nikodz
Junior Member
Join Date: Jul 2009
Old 08-18-2010 , 11:22   Re: Detect player
Reply With Quote #7

ok. np
nikodz is offline
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 08-18-2010 , 14:14   Re: Detect player
Reply With Quote #8

Just to point out, there is no purpose in setting ter[id] equal to false on both connect and disconnect.
RedRobster is offline
Hx7r
Member
Join Date: Mar 2009
Old 08-18-2010 , 16:24   Re: Detect player
Reply With Quote #9

Code:
public eventRoundStart(){     new g_Maxplayers;     g_Maxplayers = get_maxplayers();           for(new i=1; i<=g_Maxplayers; i++){         if(cs_get_user_team(i)==CS_TEAM_T){             ter[i]=true;         }         else if(cs_get_user_team(i)==CS_TEAM_CT){             cts[i]=true;         }     }           return PLUGIN_HANDLED; }
Hx7r is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 08-18-2010 , 17:23   Re: Detect player
Reply With Quote #10

Can i be used to get user team? It's not an index?

Code:
    for(new i=1; i<=g_Maxplayers; i++){ 
        if(cs_get_user_team(i)==CS_TEAM_T){ 
            ter[i]=true; 
        } 
        if(cs_get_user_team(i)==CS_TEAM_T){ 
            cts[i]=true; 
        } 
    } 



nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
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 21:58.


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