here you go
player will be warned not to back stab 2 times, in the third, he will be kicked
plugin will load on "35hp" and "ka" maps
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#define IsPlayer(%1) ( 1 <= %1 <= MaxPlayers )
new MaxPlayers,nick[32],detections[33]
static mapname[32]
public plugin_init(){
get_mapname(mapname,31)
if (containi(mapname,"35hp_")==-1){
return PLUGIN_HANDLED_MAIN
}
if (containi(mapname,"ka_")==-1){
return PLUGIN_HANDLED_MAIN
}
register_plugin( "NoBackStab", "1.0", "alliedmodders")
RegisterHam( Ham_TakeDamage, "player", "detectDamage" )
register_clcmd("prevention", "prevention")
MaxPlayers = get_maxplayers()
}
public client_connect(id){
detections[id]=0
}
public detectDamage(Victim, Inflictor, Attacker, Float:Damage, Damagebits){
if(IsPlayer(Attacker) && Damage==195.0){
client_cmd(Attacker, "prevention")
}
}
public prevention(id){
set_hudmessage(255, 255, 255, -1.0, 0.4, 6.0, 12.0, 5.0)
client_cmd(id, "speak danger")
switch(detections[id]){
case 0:{
show_hudmessage(id, "[1/3] Don't Stab players in the back!!!")
}
case 1:{
show_hudmessage(id, "[2/3] Don't Stab players in the back - last warning!!!")
}
case 2:{
get_user_name(id,nick,sizeof nick -1)
client_print(0,print_chat,"[Anti-BackStab] Player %s was kicked for back Stabing!!!", nick)
server_cmd("kick #%d Don't Stab players in the back!!!",get_user_userid(id))
}
}
detections[id]++
}