#include <amxmodx>
#include <amxmisc>
#include <colorchat>
#include <fakemeta>
#define PLUGIN "Medic"
#define VERSION "1.0"
#define AUTHOR "Grinf4ce" // Edited by GhosT ***
new const TAG[] = "[Hide'n Seek - Medic]";
#if cellbits == 32
#define OFFSET_CSMONEY 115
#else
#define OFFSET_CSMONEY 140
#endif
#define OFFSET_LINUX 5
new MODE,REG_HEALTH, MAXHEALTH, COSTS,SHOUT, MESSAGE, COOLDOWN
new PlayerReload[33]
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("medic_version",VERSION,FCVAR_SERVER);
set_cvar_string("medic_version",VERSION);
/* Register CVARs */
MODE = register_cvar("medic_enabled","1") /* Mode 1: On ;; Mode 0: Off */
REG_HEALTH = register_cvar("medic_health","40") // How many Health you get instantly?
MAXHEALTH = register_cvar("medic_maxhp","120") // Maximal HP for everyone
COSTS = register_cvar("medic_costs","1") // How many costs medic?
SHOUT = register_cvar("medic_shout","1") // Shout Medic if you buy medic?
MESSAGE = register_cvar("medic_message","1") // Write a Message if you buy medic?
COOLDOWN = register_cvar("medic_cooldown","7") // Cooldown-Time in Seconds
/* Register Commands */
register_clcmd("/medic","call_medic",ADMIN_ALL)
register_clcmd("medic","call_medic",ADMIN_ALL)
register_clcmd("say /medic","call_medic",ADMIN_ALL)
register_clcmd("say medic","call_medic",ADMIN_ALL)
register_clcmd("say_team /medic","call_medic",ADMIN_ALL)
register_clcmd("say_team medic","call_medic",ADMIN_ALL)
}
public plugin_precache() {
precache_sound("medic.wav")
}
public client_connect(id) {
PlayerReload[id] = 0
}
public client_disconnect(id) {
PlayerReload[id] = 0
}
public call_medic(id) {
/* Mods and Stuff */
if(get_pcvar_num(MODE) == 1 && PlayerReload[id] < time())
{
new ActuellHP = get_user_health(id);
new ActuellMoney = fm_cs_get_user_money(id);
if(ActuellMoney < get_pcvar_num(COSTS))
{
ColorChat(id, RED, "^x04%s^x01 Nu ai^x04 bani^x01 pentru a chema^x04 medicul^x01 !",TAG)
}
else
{
if(ActuellHP < get_pcvar_num(MAXHEALTH))
{
/* Shout if activated */
/* Write message if activated */
new playerCount, i, players[32], name[33];
get_players(players, playerCount, "ach");
get_user_name(id,name,32)
for(i=1; i<=playerCount; i++)
{
if(get_user_team(id) == get_user_team(i))
{
if(get_pcvar_num(MESSAGE) == 1)
{
ColorChat(i, RED, "^x04[HNS.EXE-CS.COM]^x03 %s ^x04(^x03 RADIO^x04 ) ^x03:^x04 Medic !",name)
if(get_pcvar_num(SHOUT) == 1)
{
engfunc(EngFunc_EmitSound, i, CHAN_ITEM, "medic.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
}
}
}
}
new Float:Lebenplus = get_pcvar_float(REG_HEALTH);
if(ActuellHP + Lebenplus > get_pcvar_num(MAXHEALTH))
{
set_pev(id,pev_health,get_pcvar_float(MAXHEALTH))
ShakeScreen(id, 1.0);
FadeScreen(id , 0.7, 0, 255, 12, 160);
ColorChat(id, RED, "^x04%s^x01 Medicul ti-a incarcat toata viata !", TAG);
}
else if(ActuellHP + Lebenplus <= 50)
{
set_pev(id, pev_health, ActuellHP + Lebenplus);
ShakeScreen(id, 1.0);
FadeScreen(id , 0.7, 255, 43, 0, 160);
ColorChat(id, RED, "^x04%s^x01 Medicul ti-a dat %d HP !", TAG, get_pcvar_num(REG_HEALTH));
}
else if(ActuellHP + Lebenplus > 50 && (ActuellHP + Lebenplus <= 90 && ActuellHP + Lebenplus > 50))
{
set_pev(id, pev_health, ActuellHP + Lebenplus);
ShakeScreen(id, 1.0);
FadeScreen(id , 0.7, 0, 43, 255, 160);
ColorChat(id, RED, "^x04%s^x01 Medicul ti-a dat %d HP !", TAG, get_pcvar_num(REG_HEALTH));
}
else if(ActuellHP + Lebenplus >= 90 && ActuellHP + Lebenplus < get_pcvar_num(MAXHEALTH))
{
set_pev(id, pev_health, ActuellHP + Lebenplus);
ShakeScreen(id, 1.0);
FadeScreen(id , 0.7, 0, 200, 100, 200);
ColorChat(id, RED, "^x04%s^x01 Medicul ti-a dat %d HP !", TAG, get_pcvar_num(REG_HEALTH));
}
PlayerReload[id] = time() + get_pcvar_num(COOLDOWN) /* Activate Reload */
fm_cs_set_user_money(id,ActuellMoney-get_pcvar_num(COSTS),1) /* Pay.. */
}
else
ColorChat(id, RED, "^x04%s^x01 Ai deja 120 HP !", TAG)
}
}
else
{
if(get_pcvar_num(MODE) != 1)
ColorChat(id, RED, "^x04%s^x01 Medicul este in concediu!")
else
{
new Seconds = PlayerReload[id] - time()
ColorChat(id, RED, "^x04%s^x01 Abia ce ai chemat medicul. Asteapta %i secunde..",TAG, Seconds)
}
}
return PLUGIN_HANDLED;
}
stock fm_cs_set_user_money(id,money,flash=1)
{
set_pdata_int(id,OFFSET_CSMONEY,money,OFFSET_LINUX);
message_begin(MSG_ONE,get_user_msgid("Money"), {0,0,0}, id);
write_long(money);
write_byte(flash);
message_end( );
}
stock fm_cs_get_user_money(id)
{
return get_pdata_int(id,OFFSET_CSMONEY,OFFSET_LINUX);
}
public ShakeScreen(id, const Float:seconds)
{
message_begin(MSG_ONE, get_user_msgid("ScreenShake"), {0, 0, 0}, id);
write_short(floatround(4096.0 * seconds, floatround_round));
write_short(floatround(4096.0 * seconds, floatround_round));
write_short(1<<13);
message_end( );
}
public FadeScreen(id, const Float:seconds, const red, const green, const blue, const alpha)
{
message_begin(MSG_ONE, get_user_msgid("ScreenFade"), _, id);
write_short(floatround(4096.0 * seconds, floatround_round));
write_short(floatround(4096.0 * seconds, floatround_round));
write_short(0x0000);
write_byte(red);
write_byte(green);
write_byte(blue);
write_byte(alpha);
message_end( );
}