Raised This Month: $ Target: $400
 0% 

Heal When Not Moving?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Zombie Lurker
Senior Member
Join Date: Mar 2009
Old 06-03-2009 , 02:57   Heal When Not Moving?
Reply With Quote #1

I'd like someone to give me an example of how to make all players heal when not moving for three seconds. I have tried it myself but my horrible job makes my game have insane lag and crash. Here's my code :
PHP Code:
public HPBase(idHEAL) {
 static 
itarget
 
static Float:velocity[3]
 static 
Float:speed
 
 
for(i=1i<=g_maxplayersi++) {
  
target pev(ipev_iuser1) == pev(ipev_iuser2) : i
  pev
(targetpev_velocityvelocity)
 
  
speed vector_length(velocity)
 
  if (
speed == 0)
   
set_task(3.0"HPBase"id__"b")
   else 
remove_task(HEAL)
 }
 
 new 
cur_hp get_user_health(id)
 new 
am_hp 200
 
if (speed == && is_user_alive(id))
  if (
cur_hp max_hp)
   
set_user_health(victimcur_hp am_hp)

All help appreciated!
__________________
Zombie Lurker is offline
 


Thread Tools
Display Modes

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 14:01.


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