Raised This Month: $ Target: $400
 0% 

healing by 50?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bone
Member
Join Date: Mar 2005
Location: Under your bed
Old 04-16-2005 , 14:36   healing by 50?
Reply With Quote #1

I am adding medic into my rp plug in i got it working except instead of makign people health automatically 100 i want it to heal by 50 but when i changed

Code:
public medicheal(id) {         set_user_health(id,100)       return 1; }


into

Code:
public medicheal(id) {         set_user_health(player,id + 10)       return 1; }

I get a few errors.. i dont get whats wrong with it anyone know?
__________________
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
Belsebub
Senior Member
Join Date: Feb 2005
Location: Sweden
Old 04-16-2005 , 14:41  
Reply With Quote #2

post what errors you get
Belsebub is offline
Bone
Member
Join Date: Mar 2005
Location: Under your bed
Old 04-16-2005 , 14:42  
Reply With Quote #3

i get

undefined symbol health

expected tokenn ; but found )
__________________
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
Belsebub
Senior Member
Join Date: Feb 2005
Location: Sweden
Old 04-16-2005 , 14:46  
Reply With Quote #4

you gotta do like this:

Code:
new health = get_user_health(id) set_user_health(id,health + 10)
Belsebub is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-16-2005 , 16:40  
Reply With Quote #5

Or, you can make it even shorter.
Code:
set_user_health(id, get_user_health(id) + 10)

PS: I showed you how to do this in your other topic you posted.
__________________
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 , 20:07  
Reply With Quote #6

thanks worked perfect :-D

yeah i know you showed me.. but it was the new health thing i was putting it at wrong spot :-/ thanks thou,

now how could i go about making it so like he can only heal every minute i was thinking of going bout it and make like

Code:
new canheal = 1;

Code:
public medicheal(id) { if(canheal = 0) {             client_print(id,print_chat,"* [MCMD] You must wait to heal again^n");         }         else {  new health = get_user_health(id)    set_user_health(id,health + 50)  set_task(0.1,"abletoheal",player);       return 1; }

Code:
public abletoable(id) {     canheal = 1; }         return PLUGIN_HANDLED; }

would something like that be correct im not quite sure if that would work or not.
__________________
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 , 20:15  
Reply With Quote #7

Something like this. I'm not that great with set_task() yet, so don't yell at me if I'm wrong!
Code:
new canheal[33] public myFunction(id) {     // ..     canheal[id] = 0     set_task(60.0,"abletoheal",id)     return PLUGIN_HANDLED } public abletoheal(id) {     canheal[id] = 1     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 , 20:20  
Reply With Quote #8

i think i figured it out, i just formatted so gotta wait to test it but here is what i did

Code:
 //heal again  new canheal = 1;

Code:
 ////////////////////////////////////////////////////////////////////  // Medical  //////////////////////////////////////////////////////////////////  public handlesaytwo(id) {     new arg[64], arg1[32], arg2[32];     read_args(arg,63); // get text     remove_quotes(arg); // remove quotes     strtok(arg,arg1,255,arg2,255,' ',1); // split text into parts     // eliminate extra spaces from the text     trim(arg2); // our right side     // if player is dead     if(is_user_alive(id) == 0) {         return PLUGIN_CONTINUE;     }     //     // Medic     //     if(equali(arg1,"") == 1) {         if(is_user_alive(id) == 0) {             client_print(id,print_chat,"* [MCMD] You must be alive to use this command^n");             return PLUGIN_HANDLED;         }         if(isMedic(id) == 0) { // if player is not a Medic             client_print(id,print_chat,"* [MCMD] Only Medics can heal other players^n");             return PLUGIN_HANDLED;         }         new player, body, Float:dist = get_user_aiming(id,player,body,9999);         if(player <= 0) { // no entity or is world entity             client_print(id,print_chat,"* [MCMD] Player is invalid or non-existant^n");             return PLUGIN_HANDLED;         }         // if player isn't connected (what happened here?) or player is dead         if(!is_user_connected(player) || !is_user_alive(player)) {             client_print(id,print_chat,"* [MCMD] Player is invalid or non-existant^n");             return PLUGIN_HANDLED;         }         // gotta wait to heal foo'         if(canheal <= 0) {             client_print(id,print_chat,"* [MCMD] You must wait to heal again^n");             return PLUGIN_HANDLED;         }         // not close enough         if(dist > CUFFDIST) {             client_print(id,print_chat,"* [MCMD] You are not close enough to the player^n");             return PLUGIN_HANDLED;         }         if(get_user_health(player) >= 100) { // player at max health             //client_print(id,print_chat,"* [MCMD] This user is already Fully Healed^n");             return PLUGIN_HANDLED;         }         new playername[256];         get_user_name(player,playername,255);         client_print(id,print_chat,"* [MCMD] %s is now healed^n",playername);         client_print(player,print_chat,"* [MCMD] You have been healed^n");         set_task(1.0,"medicheal",player); // delayed heal         return PLUGIN_HANDLED;     }     return PLUGIN_CONTINUE; }

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; } //////////////////////////////////////////////////////////////////// // Heal Again ////////////////////////////////////////////////////////////////// public healagain(id) {  canheal = 1;  return PLUGIN_HANDLED; }

it all compiled and that so hopefully it works.
__________________
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
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:50.


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