AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   healing plugin help? **SOLVED** (https://forums.alliedmods.net/showthread.php?t=12431)

Bone 04-15-2005 22:03

healing plugin help? **SOLVED**
 
im not sure how do this at all but i want make it so like if i can heal people now i need add in health variable or wathever u call it to get players health so i put

Code:
 new health = get_user_health(player)

and to heal them i have

Code:
health(player) = 100

is that correct?

v3x 04-15-2005 22:07

Code:
set_user_health(player,health + 10)
OR
Code:
set_user_health(player,100)

Bone 04-15-2005 22:13

damn its not working can u see whats wrong

Code:
 //Medic  new health = get_user_health(player)

Code:
        //     // Medic     //     if(equali(arg1,"/heal") == 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 have access to handcuffs^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;         }         new classname[256];         entity_get_string(player,EV_SZ_classname,classname,255);         // if the entity isn't a player entity         if(!equal(classname,"player")) {             client_print(id,print_chat,"* [MCMD] Player is invalid or non-existant^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(health(player) = 100 ) { // player already cuffed             //client_print(id,print_chat,"* [MCMD] This user is already Fully Healed^n");             client_cmd(id,"say /uncuff"); // uncuff             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); // cuff actions         return PLUGIN_HANDLED;     }

Code:
 ////////////////////////////////////////////////////////////////////  // Medic Heal  //////////////////////////////////////////////////////////////////  public doheal(id) {       set_user_health(player,100)   }     return 1;   }

when i try compile the compiler just crashes >_<

XxAvalanchexX 04-15-2005 22:19

Code:
public whatever_function_this_is_in(id) { // ... all of the other code from my plugin     //     // Medic     //     if(equali(arg1,"/heal") == 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;         }         // 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;     } } //////////////////////////////////////////////////////////////////// // Medic Heal ////////////////////////////////////////////////////////////////// public medicheal(id) {         set_user_health(id,100)       return 1; }

Bone 04-15-2005 22:30

hmm i put that in and everytime i tried compile it makes compiler crash...
and when i tried do it on online comoiler the plugin is only like 2.3kb and it was like 85kb before i added that stuff

XxAvalanchexX 04-15-2005 22:33

Works for me. I'm guessing you didn't actually use the code I just now posted.

Bone 04-16-2005 12:41

... i did use the code i you just posted i put it in handle say and then other part where it goes.... is it possible the plug in could be to big?

XxAvalanchexX 04-16-2005 12:55

No. It is possible you don't know how to code and have no idea how to place my code, though.

Bone 04-16-2005 13:07

nevermind i got it working perfect now thanks for your help.


All times are GMT -4. The time now is 09:55.

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