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

Red Blood (one bug) Take a look!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
imported_FireWalker877
Member
Join Date: Jun 2004
Location: Memphis, TN
Old 03-10-2005 , 22:22   Red Blood (one bug) Take a look!
Reply With Quote #1

Well, I think this is pretty close to being the red blood hero found on the (_msv) servers. For some reason, when an opponent hits you, instead of taking away half of his HP, he is given a great deal. I would appreciate it if someone could point out my error. Thanks!


Code:
// Redblood! Thanks to AssKicR / JTP10181 for the magneto code! And thanks to (_msv) for the idea. :)

/* CVARS - copy and paste to shconfig.cfg

//Redblood
redblood_level 10
redblood_cooldown 5				//Time delay between automatic uses
redblood_damage	.5			//Fraction of attacker's health to be deducted. Default .50
*/

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

// GLOBAL VARIABLES
new gHeroName[]="Redblood"
new bool:gHasRedbloodPowers[SH_MAXSLOTS+1]
new gSpriteLightning
//----------------------------------------------------------------------------------------------
public plugin_init()
{
	// Plugin Info
	register_plugin("SUPERHERO Redblood","1.17.6","FireWalker877")

	// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
	register_cvar("redblood_level", "10" )
	register_cvar("redblood_cooldown", "5" )
	register_cvar("redblood_damage", ".5" )

	// FIRE THE EVENT TO CREATE THIS SUPERHERO!
	shCreateHero(gHeroName, "Revenge!", "Do instant damage to an attacker!", false, "redblood_level" )

	// REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)

	// INIT
	register_srvcmd("redblood_init", "redblood_init")
	shRegHeroInit(gHeroName, "redblood_init")

	// GET MORE GUNZ!
	register_event("ResetHUD","newRound","b")
	register_event("Damage", "redblood_damage", "b", "2!0")
	
	//Shield Restrict
	shSetShieldRestrict(gHeroName)

}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
	precache_sound("ambience/deadsignal2.wav")
	gSpriteLightning = precache_model("sprites/lgtning.spr")
}
//----------------------------------------------------------------------------------------------
public newRound(id)
{
	gPlayerUltimateUsed[id] = false
}
//----------------------------------------------------------------------------------------------
public redblood_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 wolverine skills
	read_argv(2,temp,5)
	new hasPowers = str_to_num(temp)

	gHasRedbloodPowers[id] = (hasPowers != 0)

	//Reset thier shield restrict status
	//Shield restrict MUST be before weapons are given out
	shResetShield(id)
}
//----------------------------------------------------------------------------------------------
public redblood_damage(id)
{
	if (!shModActive() || !gHasRedbloodPowers[id] || gPlayerUltimateUsed[id] || !is_user_alive(id)) 
	return PLUGIN_HANDLED
	
	new attacker = get_user_attacker(id)
	new attackerHealth = get_user_health(attacker)
	new Float:redbloodDamage = get_cvar_float("redblood_damage")
	new rbHP = floatround( attackerHealth * redbloodDamage )

	if ( is_user_alive(id) && !gHasRedbloodPowers[attacker] && id != attacker ) {
		set_user_health(attacker, rbHP)
		ultimateTimer(id, get_cvar_num("redblood_cooldown") * 1.0)
		playSound(id)
		playSound(attacker)
		lightning_effect(id, attacker, 2)
	}
	setScreenFlash(attacker, 255, 0, 0, 10, 200 )  //Screen Flash
}
//----------------------------------------------------------------------------------------------
public lightning_effect(id, targetid, linewidth)
{
	message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
	write_byte( 8 )
	write_short(id)	// start entity
	write_short(targetid)	// entity
	write_short(gSpriteLightning )	// model
	write_byte( 0 ) // starting frame
	write_byte( 15 )  // frame rate
	write_byte( 10 )  // life
	write_byte( linewidth )  // line width
	write_byte( 50 )  // noise amplitude
	write_byte( 255 )	// r, g, b
	write_byte( 0 )	// r, g, b
	write_byte( 0 )	// r, g, b
	write_byte( 255 )	// brightness
	write_byte( 0 )	// scroll speed
	message_end()
}
//----------------------------------------------------------------------------------------------
public playSound(id)
{
	new parm[1]
	parm[0] = id

	emit_sound(id, CHAN_AUTO, "ambience/deadsignal2.wav", 1.0, ATTN_NORM, 0, PITCH_HIGH)
	set_task(1.5,"stopSound", 0, parm, 1)
}
//----------------------------------------------------------------------------------------------
public stopSound(parm[])
{
	new sndStop = (1<<5)
	emit_sound(parm[0], CHAN_AUTO, "ambience/deadsignal2.wav", 1.0, ATTN_NORM, sndStop, PITCH_NORM)
}
//----------------------------------------------------------------------------------------------
__________________
Get Your Free 60 GB iPod here: http://premiumipods.freepay.com/?r=21092500

^ea^ Superhero Domain: 24.145.238.133:27015
imported_FireWalker877 is offline
kanu | DarkPredator
Senior Member
Join Date: Apr 2005
Old 03-10-2005 , 22:25  
Reply With Quote #2

DUDE!!! you are multiplying the attacker's health by the damage cvar!! if that damage cvar is anything greater than 1, they are going to get more health.

EDIT: i see the default is .5 Shut my mouth.
__________________
Dark | Predator
kanu | DarkPredator is offline
imported_FireWalker877
Member
Join Date: Jun 2004
Location: Memphis, TN
Old 03-10-2005 , 22:27  
Reply With Quote #3

Whoops! haha! H/o lemme retry this.

I have a cvar and a function with the same name. That might cause a problem.

Only 9 more minutes till my server changes maps (ive bugged my users enough with this hero today)

EDIT: Nope, that wasn't the problem.
__________________
Get Your Free 60 GB iPod here: http://premiumipods.freepay.com/?r=21092500

^ea^ Superhero Domain: 24.145.238.133:27015
imported_FireWalker877 is offline
ledz32
BANNED
Join Date: Mar 2005
Old 03-12-2005 , 15:23   ty
Reply With Quote #4

wtf it was my idea give me credit and when u gunna post this hero taking so long
ledz1
ledz32 is offline
bLiNd
Veteran Member
Join Date: Mar 2005
Old 03-12-2005 , 20:26   Re: ty
Reply With Quote #5

Quote:
Originally Posted by ledz32
wtf it was my idea give me credit
your idea? i believe it was the idea of (_msv)
bLiNd is offline
imported_FireWalker877
Member
Join Date: Jun 2004
Location: Memphis, TN
Old 03-12-2005 , 21:26  
Reply With Quote #6

It was (_msv)'s concept, as far as I know. This kid got banned and hes still breaking the rules? You'd think he would take a hint.
__________________
Get Your Free 60 GB iPod here: http://premiumipods.freepay.com/?r=21092500

^ea^ Superhero Domain: 24.145.238.133:27015
imported_FireWalker877 is offline
shmodfreak
BANNED
Join Date: Mar 2005
Old 03-12-2005 , 21:32   ty
Reply With Quote #7

is this hero gunna be posted sonner or later
shmodfreak is offline
imported_FireWalker877
Member
Join Date: Jun 2004
Location: Memphis, TN
Old 03-12-2005 , 21:36  
Reply With Quote #8

I fixed it! W00t! I'll compile and post shortly.
__________________
Get Your Free 60 GB iPod here: http://premiumipods.freepay.com/?r=21092500

^ea^ Superhero Domain: 24.145.238.133:27015
imported_FireWalker877 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 19:23.


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