AlliedModders

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

Vechta 08-18-2010 08:27

Detect player
 
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 :D)

nikhilgupta345 08-18-2010 10:28

Re: Detect player
 
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?????????????

Vechta 08-18-2010 10:29

Re: Detect player
 
yes.., but if player was terrorist they change to ct team on new round the old cts doesnt change team

nikhilgupta345 08-18-2010 10:40

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

nikodz 08-18-2010 11:07

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

Vechta 08-18-2010 11:14

Re: Detect player
 
I think that is what i need :D

thanks i will test later^^

nikodz 08-18-2010 11:22

Re: Detect player
 
ok. np :)

RedRobster 08-18-2010 14:14

Re: Detect player
 
Just to point out, there is no purpose in setting ter[id] equal to false on both connect and disconnect.

Hx7r 08-18-2010 16:24

Re: Detect player
 
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; }

nikhilgupta345 08-18-2010 17:23

Re: Detect player
 
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;
        }
    }






All times are GMT -4. The time now is 21:58.

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