Raised This Month: $ Target: $400
 0% 

Respawn in game mode


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JUSTINR
Member
Join Date: May 2022
Old 07-23-2022 , 11:31   Respawn in game mode
Reply With Quote #1

How can i add respawn in this mode SNIPER VS NEMESIS ?
Code:
#include < amxmodx >

#include < fun >

#include < zombie_plague_advance >



new const g_chance = 120

new const g_access_flag[] = "a"



new g_gameid, g_maxplayers, cvar_minplayers, cvar_ratio, cvar_sniperhp, cvar_nemhp, g_msg_sync



public plugin_init( )

{

	register_plugin( "[ZP] Snipers VS Nemesis Mode","1.0", "zmd94" )

	

	cvar_minplayers = register_cvar("zp_minplayers", "2")

	cvar_sniperhp =	  register_cvar("zp_sniper_hp", "1.5")

	cvar_nemhp =	  register_cvar("zp_nem_hp", "1.0")

	cvar_ratio = 	  register_cvar("zp_svn_inf_ratio", "0.5")

	

	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_flags( g_access_flag )

	

	g_gameid = zp_register_game_mode( "Sniper vs Nemesis Mode", access_flag, g_chance, 0, ZP_DM_BALANCE )

}



public zp_player_spawn_post( id )

{

	if( zp_get_current_mode() == g_gameid )

	{

		if( zp_get_user_zombie( id ))

		{

			zp_make_user_nemesis( id )

			

			set_user_health( id, floatround(get_user_health(id) * get_pcvar_float(cvar_nemhp)) )

		}

		else

		{

			zp_make_user_sniper( id )

			

			set_user_health( id, floatround(get_user_health(id) * get_pcvar_float(cvar_sniperhp)) )

		}

	}

}



public zp_round_started_pre( game )

{

	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_started( game, id )

{

	if( game == g_gameid )

	{

		set_hudmessage(221, 156, 21, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1)

		ShowSyncHudMsg(0, g_msg_sync, "Snipers vs Nemesis Mode!")

	}

}



public zp_game_mode_selected( gameid, id )

{

	if( gameid == g_gameid )

		start_svn_mode( )



	return PLUGIN_CONTINUE

}



start_svn_mode( )

{

	static i_nemesiss, i_max_nemesiss, id, i_alive

	i_alive = fn_get_alive_players()

	id = 0

	

	i_max_nemesiss = floatround( ( i_alive * get_pcvar_float( cvar_ratio ) ), floatround_ceil )

	i_nemesiss = 0

	

	while (i_nemesiss < i_max_nemesiss)

	{

		if ( (++id) > g_maxplayers) id = 1

		

		if ( !is_user_alive(id) )

			continue;

		

		if (random_num(1, 5) == 1)

		{

			zp_make_user_nemesis(id)

			

			set_user_health( id, floatround(get_user_health(id) * get_pcvar_float(cvar_nemhp)) )

			

			i_nemesiss++

		}

	}

	

	for (id = 1; id <= g_maxplayers; id++)

	{

		if ( !is_user_alive(id) || zp_get_user_nemesis(id) )

			continue;

			

		zp_make_user_sniper(id)

		

		set_user_health( id, floatround(get_user_health(id) * get_pcvar_float(cvar_sniperhp)) )

	}

}



fn_get_alive_players( )

{

	static i_alive, id

	i_alive = 0

	

	for ( id = 1; id <= g_maxplayers; id++ )

	{

		if( is_user_alive( id ) )

			i_alive++

	}

	return i_alive;

}



public native_is_svn_round()

{

    return zp_get_current_mode() == g_gameid ? true : false

}

Last edited by JUSTINR; 07-23-2022 at 11:31.
JUSTINR is offline
JUSTINR
Member
Join Date: May 2022
Old 07-25-2022 , 06:32   Re: Respawn in game mode
Reply With Quote #2

Someone?
JUSTINR is offline
damage220
Member
Join Date: Jul 2022
Location: Ukraine
Old 07-25-2022 , 07:50   Re: Respawn in game mode
Reply With Quote #3

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

public plugin_init()
{
    
/* ... */
    
RegisterHam(Ham_Killed"player""death_event"1);
}

public 
death_event(victimattackershouldgib)
{
    
ExecuteHamB(Ham_CS_RoundRespawnvictim);


Last edited by damage220; 07-25-2022 at 07:57.
damage220 is offline
JUSTINR
Member
Join Date: May 2022
Old 07-26-2022 , 02:34   Re: Respawn in game mode
Reply With Quote #4

This respawn in snipers/nemesis in all round?
JUSTINR is offline
XSlayer
Member
Join Date: Dec 2021
Old 07-26-2022 , 03:30   Re: Respawn in game mode
Reply With Quote #5

Quote:
Originally Posted by JUSTINR View Post
This respawn in snipers/nemesis in all round?
PHP Code:
public zp_player_spawn_postid 
i think u already have a public for that, u just need it to register ham spawn with this public name, and the job is done

PHP Code:
RegisterHamHam_Spawn"player""zp_player_spawn_post"); 
try registering the forward ( Spawn for Players )

Also u can check this list of full tutorials, all about zombie plage:
https://forums.alliedmods.net/showth...taFileHandling

Last edited by XSlayer; 07-26-2022 at 03:41.
XSlayer is offline
JUSTINR
Member
Join Date: May 2022
Old 07-26-2022 , 05:53   Re: Respawn in game mode
Reply With Quote #6

I edit , but no working ...

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

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

new g_gameid, g_maxplayers, cvar_minplayers, cvar_ratio, cvar_sniperhp, cvar_nemhp, g_msg_sync

public plugin_init( )
{
	register_plugin( "[ZP] Snipers VS Nemesis Mode","1.0", "zmd94" )
	RegisterHam( Ham_Spawn, "player", "zp_player_spawn_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_flags( g_access_flag )
	
	g_gameid = zp_register_game_mode( "Sniper vs Nemesis Mode", access_flag, g_chance, 0, ZP_DM_BALANCE )
}

public zp_player_spawn_post( id )
{
	if( zp_get_current_mode() == g_gameid )
	{
		if( zp_get_user_zombie( id ))
		{
			zp_make_user_nemesis( id )
			
			set_user_health( id, floatround(get_user_health(id) * get_pcvar_float(cvar_nemhp)) )
		}
		else
		{
			zp_make_user_sniper( id )
			
			set_user_health( id, floatround(get_user_health(id) * get_pcvar_float(cvar_sniperhp)) )
		}
	}
}

public zp_round_started_pre( game )
{
	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_started( game, id )
{
	if( game == g_gameid )
	{
		set_hudmessage(221, 156, 21, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1)
		ShowSyncHudMsg(0, g_msg_sync, "Snipers vs Nemesis Mode!")
	}
}

public zp_game_mode_selected( gameid, id )
{
	if( gameid == g_gameid )
		start_svn_mode( )

	return PLUGIN_CONTINUE
}

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

fn_get_alive_players( )
{
	static i_alive, id
	i_alive = 0
	
	for ( id = 1; id <= g_maxplayers; id++ )
	{
		if( is_user_alive( id ) )
			i_alive++
	}
	return i_alive;
}

public native_is_svn_round()
{
    return zp_get_current_mode() == g_gameid ? true : false
}
JUSTINR is offline
damage220
Member
Join Date: Jul 2022
Location: Ukraine
Old 07-26-2022 , 10:06   Re: Respawn in game mode
Reply With Quote #7

Quote:
Originally Posted by JUSTINR View Post
This respawn in snipers/nemesis in all round?
It respawns on player death. I know nothing about this mode and how it works. Try to paste this code and reply whether it works or not.
damage220 is offline
JUSTINR
Member
Join Date: May 2022
Old 07-26-2022 , 12:17   Re: Respawn in game mode
Reply With Quote #8

Quote:
Originally Posted by JUSTINR View Post
I edit , but no working ...

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

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

new g_gameid, g_maxplayers, cvar_minplayers, cvar_ratio, cvar_sniperhp, cvar_nemhp, g_msg_sync

public plugin_init( )
{
	register_plugin( "[ZP] Snipers VS Nemesis Mode","1.0", "zmd94" )
	RegisterHam( Ham_Spawn, "player", "zp_player_spawn_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_flags( g_access_flag )
	
	g_gameid = zp_register_game_mode( "Sniper vs Nemesis Mode", access_flag, g_chance, 0, ZP_DM_BALANCE )
}

public zp_player_spawn_post( id )
{
	if( zp_get_current_mode() == g_gameid )
	{
		if( zp_get_user_zombie( id ))
		{
			zp_make_user_nemesis( id )
			
			set_user_health( id, floatround(get_user_health(id) * get_pcvar_float(cvar_nemhp)) )
		}
		else
		{
			zp_make_user_sniper( id )
			
			set_user_health( id, floatround(get_user_health(id) * get_pcvar_float(cvar_sniperhp)) )
		}
	}
}

public zp_round_started_pre( game )
{
	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_started( game, id )
{
	if( game == g_gameid )
	{
		set_hudmessage(221, 156, 21, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1)
		ShowSyncHudMsg(0, g_msg_sync, "Snipers vs Nemesis Mode!")
	}
}

public zp_game_mode_selected( gameid, id )
{
	if( gameid == g_gameid )
		start_svn_mode( )

	return PLUGIN_CONTINUE
}

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

fn_get_alive_players( )
{
	static i_alive, id
	i_alive = 0
	
	for ( id = 1; id <= g_maxplayers; id++ )
	{
		if( is_user_alive( id ) )
			i_alive++
	}
	return i_alive;
}

public native_is_svn_round()
{
    return zp_get_current_mode() == g_gameid ? true : false
}
I edit with this code , but dont working ... I think I have to use native in the base.
JUSTINR is offline
wilian159
Member
Join Date: Dec 2013
Old 07-26-2022 , 12: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

__________________
Hmm, nice....... www.addonscs.com

Last edited by wilian159; 07-26-2022 at 12:34.
wilian159 is offline
JUSTINR
Member
Join Date: May 2022
Old 07-26-2022 , 16:06   Re: Respawn in game mode
Reply With Quote #10

Give respawn , but spawn humans / zombies no snipers /nemesis
JUSTINR is offline
Reply


Thread Tools
Display Modes

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 22:02.


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