Knife spawn protection
#1
para los servidores knife con respawn (35hp, 1hp)

Código PHP:
#include <amxmodx>
#include <fun>
#include <hamsandwich>
#include <engine>

new on_protect[33]
new 
cvar_mode

new hp1 false
new hp35 false

public plugin_init()
{
    
register_plugin("Knife spawn protect""1.0""Nelo")
    
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn_Post"1)

    
cvar_mode register_cvar("knife_mode""0")
    
    new 
mapname[64]
    
get_mapname(mapname,charsmax(mapname))
    
    if(
contain(mapname,"35hp") != -1)
    {
        
hp35 true
        hp1 
false
    
}
        
    else if(
contain(mapname,"1hp") != -1)
    {
        
hp1 true
        hp35 
false
    
}

    new 
entname[64]
    new 
entcount entity_count() 
    for (new 
id 33id entcountid++) 
    { 
        if(!
is_valid_ent(id)) 
            continue; 
        
        
entity_get_string(idEV_SZ_classnameentname64
        if (
equali(entname"game_player_hurt"))
            
remove_entity(id)
    }
}

public 
plugin_cfg()
    
set_pcvar_num(cvar_mode0)

public 
fw_PlayerSpawn_Post(id)
{
    if(!
is_user_alive(id))
        return
    
    
on_protect[id] = 1
    set_user_rendering
(id,kRenderFxGlowShell,0,255,0,kRenderNormal,25)
    
set_user_godmode(id1)
}

public 
remove_protect(id)
{
    if(!
get_pcvar_num(cvar_mode))
    {
        if(
hp35)
            
set_user_health(id35)
        
        else if(
hp1)
            
set_user_health(id1)
    }

    else
    {
        if(
get_pcvar_num(cvar_mode) == 1)
            
set_user_health(id1)

        else if(
get_pcvar_num(cvar_mode) == 2)
            
set_user_health(id35)

        else if(
get_pcvar_num(cvar_mode) >= 3)
            
set_user_health(id100)
    }
    
    
on_protect[id] = 0
    set_user_rendering
(id,kRenderFxGlowShell,0,0,0,kRenderNormal,25)
    
set_user_godmode(id0)
    
screenfade(id)
}

public 
client_disconnect(id)
{
    
remove_task(id)
    
on_protect[id] = 0
}

public 
client_PreThink(id)
{
    if(
is_user_alive(id) && on_protect[id])
    {
        new 
flags entity_get_int(idEV_INT_flags)
        new 
onground flags FL_ONGROUND

        
if(onground && !task_exists(id))
            
set_task(0.5"remove_protect"id)
    }
}

screenfade(id)
{
    
message_begin(MSG_ONEget_user_msgid("ScreenFade"), {0,0,0}, id)
    
write_short(1<<10)
    
write_short(1<<10)
    
write_short(0x0000)
    
write_byte(0)
    
write_byte(200)
    
write_byte(0)
    
write_byte(75)
    
message_end()



Archivos adjuntos
.sma   Descargar AMXX / knife_spawn_protect.sma (Tamaño: 2.13 KB / Descargas: 38)
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)