Raised This Month: $ Target: $400
 0% 

Respawn in game mode


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
wilian159
Member
Join Date: Dec 2013
Old 07-26-2022 , 11:31   Re: Respawn in game mode
Reply With Quote #9

test:

PHP Code:
#include <amxmodx>
#include <fun>
#include <zombie_plague_advance>
#include <hamsandwich>

new const g_chance 120
new const g_access_flag[] = "a"

new g_gameidg_maxplayerscvar_minplayerscvar_ratiocvar_sniperhpcvar_nemhpg_msg_sync

public plugin_init( )
{
    
register_plugin"[ZP] Snipers VS Nemesis Mode","1.0""zmd94" 
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled_Post"1)

    
cvar_minplayers register_cvar("zp_minplayers""2")
    
cvar_sniperhp =      register_cvar("zp_sniper_hp""1.5")
    
cvar_nemhp =      register_cvar("zp_nem_hp""0.3")
    
cvar_ratio =       register_cvar("zp_svn_inf_ratio""0.4")
    
    
g_maxplayers get_maxplayers()
    
g_msg_sync CreateHudSyncObj()
}

public 
plugin_natives()
{
    
register_native("zp_is_svn_round""native_is_svn_round"1)
}

public 
plugin_precache( )
{
    new 
access_flag read_flagsg_access_flag )
    
    
g_gameid zp_register_game_mode"Sniper vs Nemesis Mode"access_flagg_chance0ZP_DM_BALANCE )
}

public 
fw_PlayerKilled_Post(victimattackershouldgib)
{
    if(
is_user_connected(victim) && zp_get_current_mode() == g_gameid)
    {
        
set_task(2.0"xReviveUser"victim)
    }
}

public 
xReviveUser(victim)
{
    if(
is_user_connected(victim) && zp_get_current_mode() == g_gameid)
    {
        new 
random_num(01)
        
zp_respawn_user(victimZP_TEAM_SNIPER ZP_TEAM_NEMESIS)
    }
}

public 
zp_round_started_pregame )
{
    if( 
game == g_gameid )
    {
        if( 
fn_get_alive_players() < get_pcvar_num(cvar_minplayers) )
        {
            return 
ZP_PLUGIN_HANDLED
        
}
        
start_svn_mode( )
    }
    return 
PLUGIN_CONTINUE
}

public 
zp_round_startedgameid )
{
    if( 
game == g_gameid )
    {
        
set_hudmessage(22115621, -1.00.1710.05.01.01.0, -1)
        
ShowSyncHudMsg(0g_msg_sync"Snipers vs Nemesis Mode!")
    }
}

public 
zp_game_mode_selectedgameidid )
{
    if( 
gameid == g_gameid )
        
start_svn_mode( )

    return 
PLUGIN_CONTINUE
}

start_svn_mode( )
{
    static 
i_nemesissi_max_nemesissidi_alive
    i_alive 
fn_get_alive_players()
    
id 0
    
    i_max_nemesiss 
floatround( ( i_alive get_pcvar_floatcvar_ratio ) ), floatround_ceil )
    
i_nemesiss 0
    
    
while (i_nemesiss i_max_nemesiss)
    {
        if ( (++
id) > g_maxplayersid 1
        
        
if ( !is_user_alive(id) )
            continue;
        
        if (
random_num(15) == 1)
        {
            
zp_make_user_nemesis(id)
            
            
set_user_healthidfloatround(get_user_health(id) * get_pcvar_float(cvar_nemhp)) )
            
            
i_nemesiss++
        }
    }
    
    for (
id 1id <= g_maxplayersid++)
    {
        if ( !
is_user_alive(id) || zp_get_user_nemesis(id) )
            continue;
            
        
zp_make_user_sniper(id)
        
        
set_user_healthidfloatround(get_user_health(id) * get_pcvar_float(cvar_sniperhp)) )
    }
}

fn_get_alive_players( )
{
    static 
i_aliveid
    i_alive 
0
    
    
for ( id 1id <= g_maxplayersid++ )
    {
        if( 
is_user_aliveid ) )
            
i_alive++
    }
    return 
i_alive;
}

public 
native_is_svn_round()
{
    return 
zp_get_current_mode() == g_gameid true false

__________________

Last edited by wilian159; 07-26-2022 at 11:34.
wilian159 is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:34.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode