Raised This Month: $ Target: $400
 0% 

funny consequences [armor problem]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
avril-lavigne
Banned
Join Date: Apr 2009
Old 07-25-2013 , 17:19   funny consequences [armor problem]
Reply With Quote #1

Im my plugin I use armor calculations. so it takes 2/3 of damage like this

Code:
  

iDamage = DAMAGE / 3
set_pev(i, pev_armorvalue,Armor-floatround(damage) / 1.5)
as you see if some one dealt 100 damage to me, 100/3=33.33 , I would have - 100-33=77hp
and armor 100-66=33.

the problem is when damage is too high (100-120) and I have Low armor (10-30) after hit I have armor with negative values like -20, -30 ...
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc

Last edited by avril-lavigne; 07-25-2013 at 17:57.
avril-lavigne is offline
Old 07-25-2013, 17:39
Bos93
This message has been deleted by Bos93. Reason: blanking deletion reason -Moderator
avril-lavigne
Banned
Join Date: Apr 2009
Old 07-25-2013 , 17:52   Re: funny consequences [armor problem]
Reply With Quote #2

Bos93 < i know you are god of scripting. but shut your mouth and go away from this thread.

should I use "min" or "max" ? max(val1,val2)
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc

Last edited by avril-lavigne; 07-25-2013 at 18:18.
avril-lavigne is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-25-2013 , 19:27   Re: funny consequences [armor problem]
Reply With Quote #3

Just make sure final value is not < 0
set_pev(i, pev_armorvalue, floatmax(YOUR_CALCULATION, 0.0))

Anyway, if it is for cs, you should use cs_set_user_armor, so you can set armortype to 0 when armorvalue is 0, and if, before calcultion, armor amount is > 0 but armortype is 0 (can happen if a bad plugin is used), do nothing.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
avril-lavigne
Banned
Join Date: Apr 2009
Old 07-28-2013 , 22:53   Re: funny consequences [armor problem]
Reply With Quote #4

your floatmax works well. tnhx
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc
avril-lavigne 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 06:23.


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