What I want to do is enable friendlyfire only for some players in a team.
When one player shoots another, if they both have 'enabled' variable on 1, the victim will normally take the damage. But if one of them doesn't, nothing will happen:
PHP Code:
new enabled[33]
public plugin_init() {
register_message(get_user_msgid("TextMsg") , "block_message");
RegisterHam(Ham_TakeDamage, "player", "tk")
register_concmd("amx_ff", "enable", ADMIN_RCON, "")
}
public tk(victim, inflictor, killer, damage, bits) {
if (killer == victim)
{
return HAM_IGNORED;
}
if (enabled[killer] == 1 && enabled[victim] == 1) {
return HAM_IGNORED;
}
else {
return HAM_SUPERCEDE
}
return HAM_SUPERCEDE
}
public enable(id, level, cid) {
if(!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new arg[32]
read_argv(1, arg, 31)
new player = cmd_target(id, arg, CMDTARGET_NO_BOTS | CMDTARGET_ALLOW_SELF)
if(enabled[player] == 0) {
enabled[player] = 1
client_print(id, print_console, "Ukljuceno.")
return PLUGIN_HANDLED
}
if(enabled[player] == 1) {
enabled[player] = 0
client_print(id, print_console, "Iskljuceno.")
}
return PLUGIN_HANDLED
}
public block_message() {
if(get_msg_argtype(2) == ARG_STRING) {
new value[64];
get_msg_arg_string(2 , value , 63);
if(equali(value , "#Game_teammate_attack")) {
return PLUGIN_HANDLED;
}
}
return PLUGIN_CONTINUE;
}
The code works but if the victim has no armor there will be blood and he gets pushed back and slowed if you hit him in the head. How can I prevent that (except giving 9999 armor

)?