i just edit a plugin called sameipsameteam
i made it but it can not work...can you help me??thx...here is the code
Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#define PLUGIN "Same IP Same Team"
#define VERSION "1.0"
#define AUTHOR "martins"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("amx_sameIPsameTeam","1")
register_logevent( "Event_RoundStart", 2, "0=World triggered", "1=Round_Start" )
return PLUGIN_CONTINUE
}
public Event_RoundStart(){
if((get_cvar_num("amx_sameipsameteam") == 1)){
new players[32],ip[32][32],name[32][32]
new playerscount,total_count = 0,ct_count = 0,t_count = 1,m=0,n
get_players(players,playerscount,"c")
for( new i = 0 ; i <playerscount ; i++) {
get_user_ip(players[i],ip[i],31) //get IP
console_print(0,"ip[ %i ] is %s",i,ip[i])
}
for (new a = 0;a<playerscount;a++){ //get IP[a] from 1 to x
for (new b = a+1;b<playerscount;b++){ //get ip[b] from 2 to x
if (equali(ip[a],ip[b])) { //ip is same
n = a
get_user_name(players[b],name[m],31)
m = m + 1
total_count = total_count + 1
}
}
get_user_name(players[n],name[m],31)
for(new j=0;j<=m;j++){
new aa = get_user_index(name[j])
new CsTeams:userTeam = cs_get_user_team(players[aa])
if (userTeam == CS_TEAM_CT) {
ct_count = ct_count + 1
}
else if (userTeam == CS_TEAM_T){
t_count = t_count + 1
}
}
if (ct_count >= t_count){
for(new x=0;x<=m;x++){
new bb = get_user_index(name[x])
cs_set_user_team(bb,2)
client_print(0,print_chat,"players %s change team for same ip: %s",name[x],ip[n])
}
}else{
for(new y=0;y<=m;y++){
new cc = get_user_index(name[y])
cs_set_user_team(cc,1)
client_print(0,print_chat,"players %s change team for same ip: %s",name[y],ip[n])
}
}
}
}
return PLUGIN_HANDLED
}