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;
}