Raised This Month: $ Target: $400
 0% 

FM_Touch ?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
bwgrubbs1
Senior Member
Join Date: Sep 2006
Old 06-19-2007 , 02:03   Re: FM_Touch ?
Reply With Quote #8

OK...here is what I have.

Code:
if(equali(szClassname, "healer")) {     if(get_user_health(id) >= 100)         return 1;     else         set_task(2.0,"give_health",id,_,_,"b"); }

Code:
public give_health(id) {     new hp = get_user_health(id);     if(hp >= 99)     {         client_print(id, print_chat, "Debug: Setting user hp to 100");         set_user_health(id, 100);         remove_task(id);         return 1;     }     client_print(id, print_chat, "Debug: Adding 2 hp. Current HP = %d", hp);     set_user_health(id, hp+2);     return 1; }

Works...BUT...doesn't call the function every 2 seconds.

I get this in console.


Debug: Adding 2 hp. Current HP = 81
Debug: Adding 2 hp. Current HP = 83
Debug: Adding 2 hp. Current HP = 85
Debug: Adding 2 hp. Current HP = 87
Debug: Adding 2 hp. Current HP = 89
Debug: Adding 2 hp. Current HP = 91
Debug: Adding 2 hp. Current HP = 93
Debug: Adding 2 hp. Current HP = 95
Debug: Adding 2 hp. Current HP = 97
Debug: Setting user hp to 100

REAL FAST...but it does take 2 second to start.

ALSO. If you die, and you land on the block it does this...


Debug: Adding 2 hp. Current HP = -122
Debug: Adding 2 hp. Current HP = -122
Debug: Adding 2 hp. Current HP = -122
Debug: Adding 2 hp. Current HP = -122
Debug: Adding 2 hp. Current HP = -122
Debug: Adding 2 hp. Current HP = -122
Debug: Adding 2 hp. Current HP = -122
Debug: Adding 2 hp. Current HP = -122
...SPAMS THIS HARD CORE...until this

Debug: Adding 2 hp. Current HP = 1
Debug: Adding 2 hp. Current HP = 3
Debug: Adding 2 hp. Current HP = 5
Debug: Adding 2 hp. Current HP = 7
Debug: Adding 2 hp. Current HP = 9
...
Debug: Adding 2 hp. Current HP = 99
Debug: Setting user hp to 100

Help fix those two things ?
bwgrubbs1 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 10:42.


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