Raised This Month: $32 Target: $400
 8% 

Solved [REQUEST] plugin


Post New Thread Reply   
 
Thread Tools Display Modes
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
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 08-31-2018 , 05:25   Re: [REQUEST] plugin
Reply With Quote #2

Dude you've posted this exact thing 3 times now.
__________________
edon1337 is offline
killer999
Senior Member
Join Date: Dec 2013
Location: India
Old 09-01-2018 , 11:08   Re: [REQUEST] plugin
Reply With Quote #3

Quote:
Originally Posted by edon1337 View Post
Dude you've posted this exact thing 3 times now.
Just two times and I never multiposted in the same section
__________________
killer999 is offline
Send a message via Skype™ to killer999
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 09-01-2018 , 13:10   Re: [REQUEST] plugin
Reply With Quote #4

Try
PHP Code:
#include <amxmodx>
#include <fun>
#include <cstrike>
#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(PLUGINVERSIONAUTHOR)
    
g_iMaxClients get_maxplayers( );
    
register_event("HLTV""Event_NewRound""a""1=0""2=0"
    
register_logevent("logevent_round_end"2"1=Round_End")  
}

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

public 
Event_NewRound() {
    new 
players[32], pnum;
    
get_players(playerspnum"ach");
    if(
pnum MINPEOPLE) {
        
set_task(0.5,"make_hero")
    }
}

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

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

    set_user_health
id get_user_healthid ) + HEALTH );
    
set_user_armor(id get_user_armorid ) + ARMOR );
    
cs_set_user_model(id,"hero")

    new 
szName32 ]
    
get_user_nameidszName31 )
    
set_dhudmessage025500.050.4510.05.01.01.0)
    
show_dhudmessage0TEXTszName )
}

gRandomAlive(n)
{
    static 
Aliveid
    Alive 
0
    
    
for (id 1id <= g_iMaxClientsid++)
    {
        if (
is_user_alive(id))
            
Alive++
        
        if (
Alive == n)
            return 
id;
    }
    
    return -
1;
}

gAlive()
{
    static 
Aliveid
    Alive 
0
    
    
for (id 1id <= g_iMaxClientsid++)
    {
        if (
is_user_alive(id))
            
Alive++
    }
    
    return 
Alive;
}

public 
logevent_round_end()
{
    static 
id;

    for( 
id 1id <= g_iMaxClientsid++ )
    {
        if( !
is_user_connectedid ) || !g_heroid ] )
            continue;

        
g_heroid ] = false;
    }

__________________

Last edited by Airkish; 09-01-2018 at 13:10.
Airkish is offline
killer999
Senior Member
Join Date: Dec 2013
Location: India
Old 09-03-2018 , 01:38   Re: [REQUEST] plugin
Reply With Quote #5

Quote:
Originally Posted by Airkish View Post
Try
PHP Code:
#include <amxmodx>
#include <fun>
#include <cstrike>
#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(PLUGINVERSIONAUTHOR)
    
g_iMaxClients get_maxplayers( );
    
register_event("HLTV""Event_NewRound""a""1=0""2=0"
    
register_logevent("logevent_round_end"2"1=Round_End")  
}

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

public 
Event_NewRound() {
    new 
players[32], pnum;
    
get_players(playerspnum"ach");
    if(
pnum MINPEOPLE) {
        
set_task(0.5,"make_hero")
    }
}

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

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

    set_user_health
id get_user_healthid ) + HEALTH );
    
set_user_armor(id get_user_armorid ) + ARMOR );
    
cs_set_user_model(id,"hero")

    new 
szName32 ]
    
get_user_nameidszName31 )
    
set_dhudmessage025500.050.4510.05.01.01.0)
    
show_dhudmessage0TEXTszName )
}

gRandomAlive(n)
{
    static 
Aliveid
    Alive 
0
    
    
for (id 1id <= g_iMaxClientsid++)
    {
        if (
is_user_alive(id))
            
Alive++
        
        if (
Alive == n)
            return 
id;
    }
    
    return -
1;
}

gAlive()
{
    static 
Aliveid
    Alive 
0
    
    
for (id 1id <= g_iMaxClientsid++)
    {
        if (
is_user_alive(id))
            
Alive++
    }
    
    return 
Alive;
}

public 
logevent_round_end()
{
    static 
id;

    for( 
id 1id <= g_iMaxClientsid++ )
    {
        if( !
is_user_connectedid ) || !g_heroid ] )
            continue;

        
g_heroid ] = false;
    }

Thanks alot i got to know where i was going wrong
__________________

Last edited by killer999; 09-03-2018 at 01:46.
killer999 is offline
Send a message via Skype™ to killer999
Old 09-04-2018, 13:28
Ghosted
This message has been deleted by Ghosted. Reason: Nvm
tom .
Member
Join Date: May 2016
Old 09-04-2018 , 14:07   Re: [REQUEST] plugin
Reply With Quote #6

Please can you add to choose only from the CTS team to bew hero?
tom . is offline
Reply



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 17:36.


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