Raised This Month: $ Target: $400
 0% 

I need help with a custom hero.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
slamx
Member
Join Date: Jun 2006
Old 06-20-2006 , 21:26   I need help with a custom hero.
Reply With Quote #1

I was trying to make a hero for my server, and it wouldnt compile. i need help can someone help me.
it said
error 021: symbols already defined: "replace_all"
im not sure how to fix this.

Code:
// BlackHawk! - Dr.BlackHawk is from my clan

/* CVARS - copy and paste to shconfig.cfg

//BlackHawk
BlackHawk_level 0
BlackHawk_teamglow 0		//Glow Team Color when player skin in use (0=no 1=yes)
BlackHawk_m4a1 1.5		//Damage multiplyer for his m4a1
BlackHawk_health 100		//Default 100 (no extra health)
BlackHawk_armor 100		//Default 100
BlackHawk_gravity 1.0		//Default 1.0 = no extra gravity (0.50 is 50% normal gravity, ect.)
BlackHawk_speed -1		//Default -1 = no extra speed, this cvar is for all weapons (for faster then normal speed set to 321 or higher)

*/


#include <amxmod>
#include <Vexd_Utilities>
#include <superheromod>

// GLOBAL VARIABLES
new gHeroName[]="Dr. BlackHawk"
new bool:gHasBlackHawkPower[SH_MAXSLOTS+1]
new bool:gmorphed[SH_MAXSLOTS+1]
new gBlackHawkSound[]="items/suitchargeno1.wav"
//----------------------------------------------------------------------------------------------
public plugin_init()
{
	// Plugin Info
	register_plugin("SUPERHERO BlackHawk", "1.0", "Jake")

	// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
	register_cvar("BlackHawk_level", "0")
	register_cvar("BlackHawk_teamglow", "0")
	register_cvar("BlackHawk_m4a1", "1.5")
	register_cvar("BlackHawk_health", "100")
	register_cvar("BlackHawk_armor", "100")
	register_cvar("BlackHawk_gravity", "1.0")
	register_cvar("BlackHawk_speed", "-1")

	// FIRE THE EVENT TO CREATE THIS SUPERHERO!
	shCreateHero(gHeroName, "Soldier of Chaos'", "Become Dr.BlackHawk - get a battlesuit and M4A1 Assault Rifle, which does more damage.", false, "BlackHawk_level")

	// REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
	// INIT
	register_srvcmd("BlackHawk_init", "BlackHawk_init")
	shRegHeroInit(gHeroName, "BlackHawk_init")

	// EVENTS
	register_event("ResetHUD", "newSpawn", "b")
	register_event("CurWeapon", "weaponChange", "be", "1=1")
	register_event("Damage", "BlackHawk_damage", "b", "2!0")
	register_event("DeathMsg", "BlackHawk_death", "a")

	// Let Server know about Master Chief's Variables
	shSetShieldRestrict(gHeroName)
	shSetMaxHealth(gHeroName, "BlackHawk_health")
	shSetMaxArmor(gHeroName, "BlackHawk_armor")
	shSetMinGravity(gHeroName, "BlackHawk_gravity")
	shSetMaxSpeed(gHeroName, "BlackHawk_speed", "[0]")
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
	precache_model("models/player/BlackHawk/BlackHawk.mdl")
	precache_model("models/shmod/BlackHawk_v_m4a1.mdl")
	precache_model("models/shmod/BlackHawk_p_m4a1.mdl")
	precache_sound(gBlackHawkSound)
}
//----------------------------------------------------------------------------------------------
public BlackHawk_init()
{
	// First Argument is an id
	new temp[6]
	read_argv(1, temp, 5)
	new id = str_to_num(temp)

	// 2nd Argument is 0 or 1 depending on whether the id has the hero
	read_argv(2, temp, 5)
	new hasPowers = str_to_num(temp)

	if (!is_user_connected(id)) return

	//Reset thier shield restrict status
	//Shield restrict MUST be before weapons are given out
	shResetShield(id)

	if ( is_user_alive(id) ) {
		if ( hasPowers ) {
			BlackHawk_weapons(id)
			switchmodel(id)
			BlackHawk_tasks(id)
		}
		//This gets run if they had the power but don't anymore
		else if ( !hasPowers && gHasBlackHawkPower[id] ) {
			engclient_cmd(id, "drop", "weapon_m4a1")
			BlackHawk_unmorph(id)
			shRemHealthPower(id)
			shRemArmorPower(id)
			shRemGravityPower(id)
			shRemSpeedPower(id)
		}
	}

	//Sets this variable to the current status
	gHasBlackHawkPower[id] = (hasPowers != 0)
}
//----------------------------------------------------------------------------------------------
public newSpawn(id)
{
	if ( gHasBlackHawkPower[id] && is_user_alive(id) && shModActive() ) {
		set_task(0.1, "BlackHawk_weapons", id)
		BlackHawk_tasks(id)

		new clip, ammo, wpnid = get_user_weapon(id, clip, ammo)
		if (wpnid != CSW_M4A1 && wpnid > 0) {
			new wpn[32]
			get_weaponname(wpnid, wpn, 31)
			engclient_cmd(id, wpn)
		}
	}
}
//----------------------------------------------------------------------------------------------
public BlackHawk_tasks(id)
{
	set_task(1.0, "BlackHawk_morph", id)

	if( get_cvar_num("BlackHawk_teamglow") ){
		set_task(1.0, "BlackHawk_glow", id+100, "", 0, "b")
	}
}
//----------------------------------------------------------------------------------------------
public BlackHawk_weapons(id)
{
	if ( is_user_alive(id) ) {
		shGiveWeapon(id, "weapon_m4a1")
	}
}
//----------------------------------------------------------------------------------------------
public switchmodel(id)
{
	if ( !is_user_alive(id) ) return

	new clip, ammo, wpnid = get_user_weapon(id, clip, ammo)
	if (wpnid == CSW_P90) {
		// Weapon Model change thanks to [CCC]Taz-Devil
		Entvars_Set_String(id, EV_SZ_viewmodel, "models/shmod/BlackHawk_v_m4a1.mdl")
		// Weapon Model change for 3rd person view - vittu
		Entvars_Set_String(id, EV_SZ_weaponmodel, "models/shmod/BlackHawk_p_m4a1.mdl")
	}
}
//----------------------------------------------------------------------------------------------
public weaponChange(id)
{
	if ( !gHasBlackHawkPower[id] || !shModActive() ) return

	new wpnid = read_data(2)
	new clip = read_data(3)

	if ( wpnid != CSW_M4A1 ) return

	switchmodel(id)

	// Never Run Out of Ammo!
	if ( clip == 0 ) {
		shReloadAmmo(id)
	}
}
//----------------------------------------------------------------------------------------------
public BlackHawk_damage(id)
{
	if ( !shModActive() || !is_user_alive(id) ) return

	new damage = read_data(2)
	new weapon, bodypart, attacker = get_user_attacker(id, weapon, bodypart)
	new headshot = bodypart == 1 ? 1 : 0

	if ( attacker <= 0 || attacker > SH_MAXSLOTS ) return

	if ( gHasBlackHawkPower[attacker] && weapon == CSW_M4A1 && is_user_alive(id) ) {
		// do extra damage
		new extraDamage = floatround(damage * get_cvar_float("BlackHawk_m4a1mult") - damage)
		if (extraDamage > 0) shExtraDamage(id, attacker, extraDamage, "m4a1", headshot)
	}
}
//----------------------------------------------------------------------------------------------
public BlackHawk_sound(id)
{
	new SND_STOP = (1<<5)
	emit_sound(id, CHAN_AUTO, gBlackHawkSound, 0.2, ATTN_NORM, SND_STOP, PITCH_NORM)
	emit_sound(id, CHAN_AUTO, gBlackHawkSound, 0.2, ATTN_NORM, 0, PITCH_NORM)
}
//----------------------------------------------------------------------------------------------
public BlackHawk_morph(id)
{
	if ( gmorphed[id] || !is_user_alive(id) ) return

	#if defined AMXX_VERSION
	cs_set_user_model(id, "BlackHawk")
	#else
	CS_SetModel(id, "BlackHawk")
	#endif

	BlackHawk_sound(id)

	// Message
	set_hudmessage(50, 205, 50, -1.0, 0.40, 2, 0.02, 4.0, 0.01, 0.1, 7)
	show_hudmessage(id, "Dr.BlackHawk - gLoCk's Evil Twin")

	gmorphed[id] = true
}
//----------------------------------------------------------------------------------------------
public BlackHawk_unmorph(id)
{
	if ( gmorphed[id] ) {
		// Message
		set_hudmessage(50, 205, 50, -1.0, 0.40, 2, 0.02, 4.0, 0.01, 0.1, 7)
		show_hudmessage(id, "Dr.BlackHawk - MODE OFF, you returned to normal self.")

		#if defined AMXX_VERSION
		cs_reset_user_model(id)
		#else
		CS_ClearModel(id)
		#endif

		BlackHawk_sound(id)

		gmorphed[id] = false

		if ( get_cvar_num("BlackHawk_teamglow") ) {
			remove_task(id+100)
			set_user_rendering(id)
		}
	}
}
//----------------------------------------------------------------------------------------------
public BlackHawk_glow(id)
{
	id -= 100

	if ( !is_user_connected(id) ) {
		//Don't want any left over residuals
		remove_task(id+100)
		return
	}

	if ( gHasBlackHawkPower[id] && is_user_alive(id) ) {
		if ( get_user_team(id) == 1 ) {
			shGlow(id, 100, 0, 0)
		}
		else {
			shGlow(id, 0, 0, 100)
		}
	}
}
//----------------------------------------------------------------------------------------------
public BlackHawk_death()
{
	new id = read_data(2)

	if ( !gHasBlackHawkPower[id] ) return

	BlackHawk_unmorph(id)
}
//----------------------------------------------------------------------------------------------
public client_connect(id)
{
	gmorphed[id] = false
}
//----------------------------------------------------------------------------------------------
slamx 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 19:29.


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