Raised This Month: $ Target: $400
 0% 

allow only to heal up to 100?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bone
Member
Join Date: Mar 2005
Location: Under your bed
Old 04-16-2005 , 23:18   allow only to heal up to 100?
Reply With Quote #1

i successfulyl added medic into my rp plug in so they heal by 50 and gotta wait 30 seconds to heal someone again

but how do i make it so that lets say someone has 90 health and u heal em instead of haveing 140 it only goes to 100?
__________________
the shirt covered her face, she screamed and clawed, so billy stomped on the bitch until he broke in her jaw.
Bone is offline
Send a message via MSN to Bone
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-16-2005 , 23:22  
Reply With Quote #2

Code:
if(get_user_health(id) >= 100) {     if(get_user_health(id) > 100 {         set_user_health(id,100)     }     remove_task(player)     return PLUGIN_HANDLED }
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Bone
Member
Join Date: Mar 2005
Location: Under your bed
Old 04-16-2005 , 23:28  
Reply With Quote #3

damn was alot easier then i thougt
__________________
the shirt covered her face, she screamed and clawed, so billy stomped on the bitch until he broke in her jaw.
Bone is offline
Send a message via MSN to Bone
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-16-2005 , 23:32  
Reply With Quote #4

Hehe ..
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Bone
Member
Join Date: Mar 2005
Location: Under your bed
Old 04-16-2005 , 23:34  
Reply With Quote #5

ummm damn i thoughti had it but guess not i get

invalid expression assumned zero

Code:
//////////////////////////////////////////////////////////////////// // Medic Heal ////////////////////////////////////////////////////////////////// public medicheal(id) {        new health = get_user_health(id)     if(get_user_health(id) > 100 {         set_user_health(id,100)     set_task(30.0, "healagain", id);     return PLUGIN_HANDLED         }       set_user_health(id,health + 50)     canheal = 0;     set_task(30.0, "healagain", id);       return 1; }
__________________
the shirt covered her face, she screamed and clawed, so billy stomped on the bitch until he broke in her jaw.
Bone is offline
Send a message via MSN to Bone
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-16-2005 , 23:40  
Reply With Quote #6

Code:
    if(get_user_health(id) > 100 {
Missing a ). Also, use my method.. ;)
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Bone
Member
Join Date: Mar 2005
Location: Under your bed
Old 04-17-2005 , 12:29  
Reply With Quote #7

what do you mean im missing a }.. where

and i dont get how to do your method, here ill post my code i had ebfore that worked that just healed by 50, and can u add ur code into it so that it works?

Code:
//////////////////////////////////////////////////////////////////// // Medic Heal ////////////////////////////////////////////////////////////////// public medicheal(id) {       new health = get_user_health(id) set_user_health(id,health + 50) canheal = 0; set_task(30.0, "healagain", id);       return 1; }

thanks tons if you can
__________________
the shirt covered her face, she screamed and clawed, so billy stomped on the bitch until he broke in her jaw.
Bone is offline
Send a message via MSN to Bone
BioHazardousWaste
Senior Member
Join Date: Apr 2005
Location: Ontario, Canada =)
Old 04-17-2005 , 13:30  
Reply With Quote #8

Hey man, i'm a nub too, just wrote a healing script last night, so this SHOULD work, but again i'm a nub so forgive me if it doesn't, and please someone correct me if i'm wrong.. anyways, your code:

Code:
public medicheal(id) {       new health = get_user_health(id) set_user_health(id,health + 50) canheal = 0; set_task(30.0, "healagain", id);       return 1; }
hmm, obviously you've ripped this out of the middle of you code because you are missing variable and stuff. Nice idea btw with the timer, didn't know how that works, but i like it OK, my code (ps, sorry I learned vb first so I still tend to use vb convieniences, which are a tad different then most):

Code:
//Include files #include <amxmodx> #include <fun> new CanHeal[32] //Initializing Plugin (main) public plugin_init() {     register_plugin("MedicHeal", "1.00", "Steve0")//Register plugin     register_concmd("S_MedicHeal", "MedicHeal") //S_Heal is a console command that calls the MedicHeal function.         for (new i=0; i<32; i++)         CanHeal[i] = 1     } public MedicHeal(id) //passes in ID of player who called command {     //vars     new OldHealth, NewHealth         //If player can heal     if(CanHeal[id])     {         //get old health, add 50, set new health         OldHealth = get_user_health(id)         NewHealth = OldHealth + 50         set_user_health(id, NewHealth)         //Make sure user doesn't have over 100 health         if(get_user_health(id) > 100)             set_user_health(id, 100)         //set heal as unusable, set timer to enable heal         CanHeal[id]=0         set_task(30.0, "SpawnHeal", id)         return PLUGIN_HANDLED     }     return PLUGIN_HANDLED } public SpawnHeal(id) {       CanHeal[id] = 1//set heal as usuable     client_print(id, print_chat, "Healing ability now available!")//Alert user that heal is available }

Should work as is, compiled fine.
__________________
"What then is truth? Truths are illusions which we have forgotten are illusions - they are metaphors that have become worn out... this (truth) is the duty to lie according to a fixed convention.

-Friedrich Nietzsche
BioHazardousWaste is offline
Send a message via MSN to BioHazardousWaste
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 09:55.


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