Raised This Month: $ Target: $400
 0% 

check victim health


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 10-21-2019 , 17:09   check victim health
Reply With Quote #1

Hi , i want to check if current victim health (gondor health) is lower than (main health / 2) and also (/3) , however as you can see below i made it work , but it's not efficient , hope that you give me an efficient way of checking victim health.

Code:
new g_gondor_health = 1600 // an example

Code:
public On_Player_Take_Damage(victim, inflictor, attacker, Float:dmg, dmgbits) {     if (attacker == victim)       return HAM_IGNORED     if (check_user_class(g_gondar_class , victim))     {         check_health(victim) // checking victim (gondor) health     }      return HAM_HANDLED }

Code:
check_health(index) {     new current_health     current_health = get_user_health(index)     if ((g_gondar_health / 2) >= current_health)     {         set_user_maxspeed(index , 450.0)         set_user_rendering(index, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha,155)         message_begin(MSG_ALL,iconstatus,{0,0,0},index)         write_byte(1) // status (0=hide, 1=show, 2=flash)         write_string("dmg_poison") // sprite name         write_byte(255) // red         write_byte(255) // green         write_byte(0) // blue         message_end()     }     if((g_gondar_health / 3) >= current_health)     {         set_user_maxspeed(index , 800.0)         set_user_rendering(index, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha,55)         message_begin(MSG_ALL,iconstatus,{0,0,0},index)         write_byte(1) // status (0=hide, 1=show, 2=flash)         write_string("dmg_poison") // sprite name         write_byte(255) // red         write_byte(0) // green         write_byte(0) // blue         message_end()     } }
LearninG 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 02:52.


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