Raised This Month: $ Target: $400
 0% 

damage event


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 01-28-2007 , 06:00   Re: damage event
Reply With Quote #1

Quote:
Originally Posted by Mini_Midget View Post
yes it is the same but I'm not sure if damage can be a float or not so I just made it into a float then rounded it up to a integer
That makes no sense at all. Neither does your code.
Now, try to explain, what is the ammount to give to who and we will be able to fix it.

bcas current_hp + current_hp + damage = new life? makes no sense.
If attacker has 70 hp and damage 35 it would be 70 + 70 + 35 = 175.
And on top of that, that gives the player who gets damaged extra life. This means no one would be able to kill anyone unless damage > 100.

This gives attacker +(damage/3) to life
so if attacker does 140 damage he gets 46 hp:
Code:
public event_damage_lifesteal(id) {         new damage = read_data(2)     new attacker = get_user_attacker(id)         if ( ! is_user_alive(id) || ! is_user_connected(id) )         return PLUGIN_CONTINUE         new current_hp = get_user_health(attacker)     new max_hp = get_pcvar_num(zomb_hp)         current_hp += damage / 3         if ( g_zombie[attacker] ) {         if ( current_hp >= max_hp )             set_user_health(attacker, max_hp)         else             set_user_health(attacker, current_hp)     }     return PLUGIN_CONTINUE }

Last edited by [ --<-@ ] Black Rose; 01-28-2007 at 06:11.
[ --<-@ ] Black Rose 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 00:41.


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