Raised This Month: $12 Target: $400
 3% 

Convert issue


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
killer999
Senior Member
Join Date: Dec 2013
Location: India
Old 08-30-2018 , 05:16   Convert issue
Reply With Quote #1

I tried converting this plugin from zp to normal
plugin is compiling but its not running can anyone tell me where am i doing mistake?

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

#define PLUGIN "[ZP] CSO"
#define VERSION "1.0"
#define AUTHOR "Shuri"

#define HEALTH     200 
#define ARMOR      200 
#define TEXT       "%s is Selected as Hero" 
#define MINPEOPLE  2 
#define MAX_PLAYERS 32

new g_hero[33] , g_iMaxClients ;

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


public round_started(round)
{
	if (get_playersnum() < MINPEOPLE )
		return;
	{
		set_task(10.0,"make_hero")
	}

}

public make_hero(id)
{		
	new id
	static iPlayersNum
	iPlayersNum = gAlive()
	id = gRandomAlive(random_num(1, iPlayersNum))
	g_hero[id] = true
	set_user_health( id , get_user_health( id ) + HEALTH );
	set_user_armor(id , get_user_armor( id ) + ARMOR );

	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 (Alive == n)
			return id;
	}
	
	return -1;
}

gAlive()
{
	static Alive, id
	Alive = 0
	
	for (id = 1; id <= g_iMaxClients; id++)
	return Alive;
}

public round_ended()
{
	static id;

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

		g_hero[ id ] = false;
	}
}
__________________
killer999 is offline
Send a message via Skype™ to killer999
Natsheh
Veteran Member
Join Date: Sep 2012
Old 08-30-2018 , 06:02   Re: Convert issue
Reply With Quote #2

Hook round start.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
killer999
Senior Member
Join Date: Dec 2013
Location: India
Old 08-30-2018 , 12:11   Re: Convert issue
Reply With Quote #3

Quote:
Originally Posted by Natsheh View Post
Hook round start.
Done but getting debug error
Quote:
L 08/30/2018 - 21:29:20: [AMXX] Displaying debug trace (plugin "ahero.amxx")
L 08/30/2018 - 21:29:20: [AMXX] Run time error 4: index out of bounds
L 08/30/2018 - 21:29:20: [AMXX] [0] ahero.sma::make_hero (line 46)
__________________
killer999 is offline
Send a message via Skype™ to killer999
Natsheh
Veteran Member
Join Date: Sep 2012
Old 08-30-2018 , 12:29   Re: Convert issue
Reply With Quote #4

Quote:
Originally Posted by killer999 View Post
Done but getting debug error
Search how to get random alive player.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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 12:07.


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