PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <fakemeta_util>
#include <hamsandwich>
#define PLUGIN "Split Terrorists"
#define VERSION "1.0"
#define AUTHOR "akcaliberg"
#define ADMIN_FLAG ADMIN_KICK
new gTeam[33];
new bool:game_started;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /split","cmdSplit")
register_concmd("amx_split","cmdSplit")
RegisterHam(Ham_TakeDamage,"player","fwd_HamTakeDamage",0)
register_logevent("eRoundEnd",2,"1=Round_End")
}
public cmdSplit(id) {
if(!access(id,ADMIN_FLAG)) {
client_print(id,print_chat,"You have no access to this command.")
console_print(id,"You have no access to this command.")
return PLUGIN_HANDLED
}
new players[32],inum;
static tempid, bool:redteam;
get_players(players,inum,"ae","TERRORIST")
for(new i;i<inum;i++) {
tempid = players[i];
if(redteam) {
fm_set_user_rendering(tempid,kRenderFxGlowShell,255,0,0,kRenderNormal,25);
gTeam[tempid] = 1;
}
else {
fm_set_user_rendering(tempid,kRenderFxGlowShell,0,0,255,kRenderNormal,25);
gTeam[tempid] = 2;
}
if(redteam) {
redteam = false;
continue;
}
if(!redteam) {
redteam = true;
continue;
}
}
set_cvar_num("mp_friendlyfire",1)
game_started = true;
return PLUGIN_HANDLED
}
public eRoundEnd() {
new players[32],inum;
get_players(players,inum)
for(new i;i<inum;i++) {
gTeam[players[i]] = 0;
fm_set_user_rendering(players[i],kRenderFxGlowShell,0,0,0,kRenderNormal,25)
}
game_started = false;
}
public fwd_HamTakeDamage(victim, inflictor, attacker, Float:damage) {
if((1 <= victim <= 32) && (1 <= attacker <= 32) && game_started) {
if(gTeam[victim] == gTeam[attacker]) {
return HAM_SUPERCEDE
}
}
return HAM_IGNORED
}
try