View Single Post
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 06-10-2018 , 22:17   Re: Plugin Block Behind Kills?
Reply With Quote #3

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")
    
RegisterHamHam_TakeDamage"player""detectDamage" )
    
register_clcmd("prevention""prevention")
    
MaxPlayers get_maxplayers() 
}
public 
client_connect(id){
    
detections[id]=0
}
public 
detectDamage(VictimInflictorAttackerFloat:DamageDamagebits){
    if(
IsPlayer(Attacker) && Damage==195.0){
        
client_cmd(Attacker"prevention")
    }
}
public 
prevention(id){
    
set_hudmessage(255255255, -1.00.46.012.05.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]++

tarsisd2 is offline