Raised This Month: $ Target: $400
 0% 

Healing Regen


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
RPRaiden
Member
Join Date: Apr 2004
Location: UK
Old 06-09-2004 , 15:39   Healing Regen
Reply With Quote #1

How would I be able to do either one of these:

A) Make it so people gradually recieve 50 hp in the space of 10 seconds.
B) Make it so health is added ontop of users health instead of setting there health?
__________________
RPRaiden is offline
Send a message via ICQ to RPRaiden Send a message via AIM to RPRaiden Send a message via MSN to RPRaiden Send a message via Yahoo to RPRaiden
[FBX]
Senior Member
Join Date: May 2004
Old 06-10-2004 , 01:27  
Reply With Quote #2

set a task every second to give 1 hp (which you'll want to keep track of using the damage event, because you cant add hit points, you have to keep track of what he has as a variable and add one to that, ande then set his health to that variable). You'll also want to keep track of how much hp you've given someone with another variable and most likely start it at 50 and count down. You can simply use arrays such as:

new healthgive[33]
new currenthealth[33]

and set healthgive[player id] to 50 whenever you want to give them health. Then using the register event command (which i dont feel like looking up its real name right now) you can find out how much health they have. (the event "Health" will tell you what their current health is, as the first byte it sends is the value.)

this will probably blow your mind if your not already familiar with scripting though. You should look through the amxmodx.inc file (in scripting/include) to see some functions that might be handy
[FBX] is offline
Jinto
Member
Join Date: Jun 2004
Location: Seattle, WA
Old 06-10-2004 , 03:25   Re: Healing Regen
Reply With Quote #3

Quote:
Originally Posted by RPRaiden
How would I be able to do either one of these:

A) Make it so people gradually recieve 50 hp in the space of 10 seconds.
B) Make it so health is added ontop of users health instead of setting there health?
Code:
#include <amxmodx> #include <amxmisc> #include <fun> //Our countdown clock new countdown; public plugin_init() {     register_plugin("Regeneration","0.9.8","Jinto");     register_clcmd("amx_regen_all","regenall",ADMIN_LEVEL_A,"Regenerates Every Players Health ( Gives 50hp in 10 seconds )");     return PLUGIN_HANDLED; } public regenall(id,level,cid) {     //Call this task every second and remove it on the 10th second     set_task(1.0,"regen",1,"",0,"b");   //Gives them 5 health every second for 10 seconds         countdown = 10;     //Set the countdown clock to 10 seconds         return PLUGIN_HANDLED; } public regen() {     //Ok first loop through all players and give them 5 health     new players = get_playersnum();     new health;         while(players > 0) {         health = get_user_health(players);         health += 5;         set_user_health(players,health);         players--;     }         //remove one from countdown and if times up remove the task     countdown--;         if(countdown < 1) {         remove_task(1);     } }

That when executed will give all players an extra 50hp within a 10 second time frame.
Jinto is offline
Send a message via ICQ to Jinto Send a message via AIM to Jinto Send a message via MSN to Jinto Send a message via Yahoo to Jinto
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 06-10-2004 , 17:12  
Reply With Quote #4

Very nice. You rock lol.
Peli is offline
Send a message via MSN to Peli
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 06-16-2004 , 23:58  
Reply With Quote #5

I was messing with it a little and fixed some errors for you , but I didn't add the comments , here it is. :
Code:
#include <amxmodx> #include <amxmisc> #include <fun> new countdown public plugin_init() {     register_plugin("Regeneration","0.9.8","Jinto")     register_clcmd("amx_regen_all","regenall",ADMIN_LEVEL_A,"Regenerates players health by 5 hp for 10 seconds" } public regenall(id,level,cid) {     set_task(1.0,"regen",1,"",0,"b")     countdown = 10      return PLUGIN_HANDLED } public regen() {     new players = get_playersnum()     new health     while(players > 0)     {         health = get_user_health(players)         health += 5         set_user_health(players,health)         players--     }             countdown--     if(countdown < 1)     {         remove_task(1)     } }
Peli is offline
Send a message via MSN to Peli
kingpin
Veteran Member
Join Date: Apr 2004
Location: kpsforum.com
Old 06-17-2004 , 00:00  
Reply With Quote #6

hmm remmeber the RedCross plugin I was working on.. hmm who was it peli? or 2|ob.. wonder who I uploaded it to.. well you can use some thing like that.. its on my server you can see it there or IM me.
__________________
kingpin is offline
Send a message via ICQ to kingpin Send a message via AIM to kingpin Send a message via MSN to kingpin Send a message via Yahoo to kingpin Send a message via Skype™ to kingpin
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 06-17-2004 , 00:02  
Reply With Quote #7

It was me. Yea you can look at that as help , it's a good source.
Peli is offline
Send a message via MSN to Peli
Jinto
Member
Join Date: Jun 2004
Location: Seattle, WA
Old 06-17-2004 , 01:50  
Reply With Quote #8

There wern't any errors you only removed the semi-colons...
Sorry about those its just habbit from C++.
Jinto is offline
Send a message via ICQ to Jinto Send a message via AIM to Jinto Send a message via MSN to Jinto Send a message via Yahoo to Jinto
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 06-17-2004 , 19:19  
Reply With Quote #9

No problem , but when I ran the compiler it came with some errors...
Peli is offline
Send a message via MSN to Peli
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 06-18-2004 , 23:50  
Reply With Quote #10

I just want to change this around a bit , but one question.
1. How do you make it so you can only regenerate at certain areas in a map?
Thanks.
Peli is offline
Send a message via MSN to Peli
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 14:52.


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