Results 1 to 2 of 2

Thread: brr_kill kada ubija igraca

  1. #1
    Vodnik
    Join Date
    Oct 2017
    Age
    20
    Posts
    5
    Karma
    3

    brr_kill kada ubija igraca

    Ovaj plugin ubija igraca ako se konektovao nakon brr_spawn_time. On radi odlicno, medjutim zelim da maknem animaciju (preview) da ubija igraca skroz, dakle samo da nastavi igru i da igrac ostane mrtav.

    Code:
    #include <amxmodx>
    #include <celltrie>
    #include <hamsandwich>
    #include <cstrike>
    #include <fun>
    
    #define MAX_PLAYERS 32
    #define VERSION "1.4-kill"
    
    //----------------------------------------------------------------------------------------------
    new _pg_is_h
    #define _IsHuman(%1) ( _pg_is_h & 1<<%1 )
    #define _SetHuman(%1) _pg_is_h |= 1<<%1
    #define _SetNotHuman(%1) _pg_is_h &= ~( 1<<%1 )
    //----------------------------------------------------------------------------------------------
    new _pg_spawned
    #define _HasSpawned(%1) ( _pg_spawned & 1<<%1 )
    #define _SetSpawned(%1) _pg_spawned |= 1<<%1
    #define _SetNotSpawned(%1) _pg_spawned &= ~(1<<%1)
    #define _GetSpawned() _pg_spawned
    //----------------------------------------------------------------------------------------------
    new _pg_block
    #define _IsBlocked(%1) ( _pg_block & 1<<%1 )
    #define _SetBlock(%1) _pg_block |= 1<<%1
    #define _SetNoBlock(%1) _pg_block &= ~(1<<%1)
    #define _GetBlocked() _pg_block
    //----------------------------------------------------------------------------------------------
    #define _NewRoundReset() _GetSpawned()&=_GetBlocked()&=_GetSpawned()
    //----------------------------------------------------------------------------------------------
    
    new bool:g_stored_ips
    new g_p_ip[MAX_PLAYERS+1][16]
    new Trie:g_trie_ips
    
    new Float:g_late_spawn_time_limit
    
    new pcvar_spawn_time
    new pcvar_enabled
    
    new bool:g_block_late_spawn
    new g_enabled
    
    public plugin_init(){
        register_plugin("BlockReconnectRespawn", VERSION, "Sylwester")
        register_cvar("brr_ver", VERSION, FCVAR_SERVER)
    
        RegisterHam(Ham_Spawn, "player", "Player_Spawn", 1)
        
        register_message(get_user_msgid("ClCorpse"), "block_ClCorpse_msg")
        register_message(get_user_msgid("DeathMsg"), "block_DeathMsg_msg")
        register_event("HLTV", "event_new_round", "a", "1=0", "2=0")
        register_logevent("logevent_round_start", 2, "1=Round_Start")
        
        pcvar_spawn_time = register_cvar("brr_spawn_time", "0")
        pcvar_enabled = register_cvar("brr_enabled", "1")
    
        g_trie_ips = TrieCreate()
    }
    
    
    public block_ClCorpse_msg(msg_id, msg_dest, msg_entity){
        if(_IsBlocked( get_msg_arg_int(12) ))
            return PLUGIN_HANDLED
        return PLUGIN_CONTINUE
    }    
    
    
    public block_DeathMsg_msg(msg_id, msg_dest, msg_entity){
        if(_IsBlocked( get_msg_arg_int(2) ))
            return PLUGIN_HANDLED
        return PLUGIN_CONTINUE
    }
    
    
    public Player_Spawn(id){
        if(!is_user_alive(id) || !_IsHuman(id))	
        if(_HasSpawned(id)){
            if(_IsBlocked(id)){
                _SetNoBlock(id)
            }
            return
        }
        _SetSpawned(id)
        if(!_IsBlocked(id)){
            if(g_block_late_spawn && g_late_spawn_time_limit < get_gametime())
                _SetBlock(id)
            else
                return
        }
        set_user_frags(id, get_user_frags(id)+1)
        cs_set_user_deaths(id, cs_get_user_deaths(id)-1)
        user_silentkill(id)
    }
    
    
    public logevent_round_start(){
        g_enabled = get_pcvar_num(pcvar_enabled)
        new late_spawn_time = get_pcvar_num(pcvar_spawn_time)
        if(late_spawn_time <= 0){
            g_block_late_spawn = false
            return
        }
        g_block_late_spawn = true
        g_late_spawn_time_limit = get_gametime()+float(late_spawn_time)
    }
    
    
    public event_new_round(){
        if(g_stored_ips){
            TrieClear(g_trie_ips)
            g_stored_ips = false
        }
        _NewRoundReset()
        g_block_late_spawn = false
    }
    
    
    public client_putinserver(id){
        if(is_user_bot(id) || is_user_hltv(id))
            return
        _SetHuman(id)
        get_user_ip(id, g_p_ip[id], 15)
        if(g_enabled && TrieKeyExists(g_trie_ips, g_p_ip[id])){
            _SetBlock(id)
        }
    }
    
    
    public client_disconnect(id){
        if(_HasSpawned(id) &&  g_enabled){
            g_stored_ips = true
            TrieSetCell(g_trie_ips, g_p_ip[id], 0)
        }
        _SetNoBlock(id)
        _SetNotSpawned(id)
        _SetNotHuman(id)
    }
    
    
    public plugin_end(){
        TrieDestroy(g_trie_ips)
    }

  2. #2
    Tech Support
    Join Date
    Feb 2013
    Age
    29
    Posts
    169
    Karma
    11

    Re: brr_kill kada ubija igraca

    Moras sacekati neko ko se bavi pawnom da ti obj kako to menjas u sma.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •