// Thanks to cruyff(CreateFade code) & MNX(idea)
#include <amxmodx>
#include <fun>
new const PLUGIN [] = "Medic !!"
new const VERSION [] = "1.2"
new const AUTHOR [] = "Akman"
new healcvar;
new healpertime;
new maxhp;
new htime;
new hsound;
new heffect;
new AAA;
new RRR;
new GGG;
new BBB;
new tag;
new bool:healthstart[33];
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
// Call the command ! //
register_clcmd("medic","HookMedic");
register_clcmd("say /heal","HookMedic");
register_clcmd("say_team /heal","HookMedic");
register_clcmd( "say", "Func_Say" );
register_clcmd( "say_team", "Func_Say" );
// Cvars //
healcvar = register_cvar("heal_hpstart","20");
healpertime = register_cvar("heal_givehp","10");
maxhp = register_cvar("heal_maxhp","100");
htime = register_cvar("heal_time","5.0");
hsound = register_cvar("heal_sound","1");
heffect = register_cvar("heal_effect","1");
AAA = register_cvar("heal_alpha","20");
BBB = register_cvar("heal_blue","200");
RRR = register_cvar("heal_red","0");
GGG = register_cvar("heal_green","0");
tag = register_cvar("heal_tag","[AMXX]");
}
public client_putinserver(id) healthstart[id] = false;
public health_scan(id)
{
new xAAA = get_pcvar_num(AAA);
new xRRR = get_pcvar_num(RRR);
new xGGG = get_pcvar_num(GGG);
new xBBB = get_pcvar_num(BBB);
new htag[50];
get_pcvar_string(tag, htag, 49);
if(get_user_health(id) < get_pcvar_num(maxhp) && healthstart[id])
{
set_user_health(id, get_user_health(id) + get_pcvar_num(healpertime));
if(get_pcvar_num(heffect))
{
CreateFade( id, xRRR, xGGG, xBBB, xAAA );
}
set_task(get_pcvar_float(htime), "health_scan", id);
if(get_pcvar_num(hsound))
{
client_cmd(id, "spk HEALTH");
}
client_print(id, print_chat, "%s Heal in progress !",htag);
}
else
{
healthstart[id] = false
remove_task(id);
client_print(id, print_chat, "%s Heal finished !",htag);
set_user_health(id, get_pcvar_num(maxhp));
}
}
public HookMedic(id)
{
new htag[50];
get_pcvar_string(tag, htag, 49);
if(!healthstart[id])
{
if(get_user_health(id) < get_pcvar_num(healcvar))
{
healthstart[id] = true;
client_print(id, print_chat, "%s Your heal is in progress !",htag);
set_task(get_pcvar_float(htime), "health_scan", id);
return 1;
}
else
{
client_print(id, print_chat, "%s You have to many health !",htag);
return 1;
}
}
else
{
client_print(id, print_chat, "%s Heal has been already started !",htag);
return 1;
}
return 0;
}
public Func_Say( id )
{
new szSaid[ 192 ];
read_args( szSaid, sizeof( szSaid ) -1 );
remove_quotes( szSaid );
if( contain( szSaid, "heal" ) != -1 )
{
HookMedic(id);
}
}
stock CreateFade( id, iRed, iGreen, iBlue, iAlpha )
{
message_begin( MSG_ONE, get_user_msgid( "ScreenFade" ), { 0, 0, 0 }, id );
write_short( 5 << 10 );
write_short( 5 << 10 );
write_short( 5 << 12 );
write_byte( iRed );
write_byte( iGreen );
write_byte( iBlue );
write_byte( iAlpha );
message_end( );
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0\\ deflang2057{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/