Raised This Month: $ Target: $400
 0% 

Help with a simple script.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Davidos
Senior Member
Join Date: Feb 2005
Old 12-01-2007 , 17:38   Help with a simple script.
Reply With Quote #1

Code:
/*AMXMODX script, made out of pure randomeness*/ #include <amxmodx> #include <engine> #include <fun> public plugin_init() {     register_plugin("Realregen","1.0","Dave")     register_event("ResetHUD", "HealthOn", "be") } public HealthOn(id) {     set_task(10.0,"Heal",id,"",0,"b")     return PLUGIN_CONTINUE } public Heal(id) {     if(!is_user_alive(id))     {         return PLUGIN_HANDLED     }     new health = get_user_health(id)     if(health>=100)     {         return PLUGIN_HANDLED     }     new speed = get_speed(id)     if(speed>=250)     {         new newhealths = health + 1         set_user_health(id,newhealths)         return PLUGIN_HANDLED     }     if(speed>25 && speed<250)     {         new newhealthm = health + 2         set_user_health(id,newhealthm)         return PLUGIN_HANDLED     }     else     {         new newhealthf = health + 3         set_user_health(id,newhealthf)         return PLUGIN_HANDLED     }     return PLUGIN_HANDLED }

This plugin is made so a certain user gets the set ammount of HP every 10 seconds, depending on movement speed etc. etc.

The problem is, for some reason, when a user dies and respawns, the HP will regain 'TWICE' the speed.

For example,
User 1 gets hit, he receives a regeneration bonus of 3 hp per 10 seconds for standing still (resting)

User 1 dies even with the health regen.

User 1 respawns, plays some more and gets hit again...
He receives a regeneration bonus of 3 hp per 5 seconds for standing still, and 3 hp more after another 5 seconds.

Anyone know how to fix the problem? I tried adding a bool function, but as usual it freaked out on me -.-;

Thanks in advance,
Dave


On a side note, this has no rush at all. I know how to do it so it actually works, but I wanna try stuff this way.
__________________
Roar.

Last edited by Davidos; 12-01-2007 at 18:42.
Davidos 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 11:07.


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