Thread: [Solved] [REQUEST] plugin
View Single Post
Author Message
killer999
Senior Member
Join Date: Dec 2013
Location: India
Old 08-31-2018 , 05:20   [REQUEST] plugin
Reply With Quote #1

can someone please make this plugin work for normal rounds ?

Code:
#include <amxmodx>
#include <fun>
#include <cstrike>
#include <zombieplague>
#include <dhudmessage>

#define PLUGIN "[ZP] CSO Addom : The Hero"
#define VERSION "1.0"
#define AUTHOR "ShuriK/ и еще кто-то"

#define HEALTH     200 
#define ARMOR      200 
#define NAMEITEM   "M-134 Minigun"
#define MODEL      "playerm"
#define TEXT       "%s Hero in round" 
#define MINPEOPLE  2 

new g_hero[33] , g_iMaxClients ;

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	g_iMaxClients = get_maxplayers( );
}

public plugin_precache()
{
	precache_model("models/player/playerm/playerm.mdl")
}

public zp_round_started(round)
{
	if (zp_get_human_count( ) < MINPEOPLE )
		return;
			
	if(round == MODE_MULTI || round == MODE_INFECTION)
	{
		set_task(0.5,"make_hero")
	}
}

public make_hero(id)
{		
	new id
	static iPlayersNum
	iPlayersNum = gAlive()

	id = gRandomAlive(random_num(1, iPlayersNum))
		
	g_hero[id] = true

	zp_force_buy_extra_item( id, zp_get_extra_item_id(NAMEITEM), 1)
	set_user_health( id , get_user_health( id ) + HEALTH );
	set_user_armor(id , get_user_armor( id ) + ARMOR );
	cs_set_user_model(id,"hero")

	new szName[ 32 ]
	get_user_name( id, szName, 31 )
	set_dhudmessage( 0, 255, 0, 0.05, 0.45, 1, 0.0, 5.0, 1.0, 1.0)
	show_dhudmessage( 0, TEXT, szName )
}

gRandomAlive(n)
{
	static Alive, id
	Alive = 0
	
	for (id = 1; id <= g_iMaxClients; id++)
	{
		if (is_user_alive(id) && !zp_get_user_zombie(id))
			Alive++
		
		if (Alive == n)
			return id;
	}
	
	return -1;
}

gAlive()
{
	static Alive, id
	Alive = 0
	
	for (id = 1; id <= g_iMaxClients; id++)
	{
		if (is_user_alive(id) && !zp_get_user_zombie(id))
			Alive++
	}
	
	return Alive;
}

public zp_round_ended()
{
	static id;

	for( id = 1; id <= g_iMaxClients; id++ )
	{
		if( !is_user_connected( id ) || !g_hero[ id ] )
			continue;

		g_hero[ id ] = false;
	}
}
__________________

Last edited by killer999; 09-03-2018 at 01:48.
killer999 is offline
Send a message via Skype™ to killer999