I know this is not the right place to post it, but recently im not getting any support in SuperHero mod scripting help section.
PHP Code:
/**///-------------------------------------------------------------------------------------------------------
//Medic - Heals teammates.
/* Cvars
//Medic
medic_level 0 //The level hero can be chosen from (default: 0)
medic_heal 2 //How much HP will it heal to others per x seconds (default: 2)
medic_heal_timer 5.0 //Afte how many seconds will the hero heal again (default: 5.0)
//Note: please use decimals (Floats) such as 4.3, 5.0, 1.9 etc.
//medic_give_hp 100 //How much will chosen player recieve hp from this hero (default: 100)
//medic_cooldown 45 //how many seconds will player have to wait untill it may use its power again (default: 45)
medic_hud_timer 1.0 //How often will the hud info be rescanned (default: 1.0)
medic_hud_on 1 //Enable or disable the hud (default: 1) (1 = enable , 0 = disable)
*/
#pragma semicolon 1
#include <superheromod>
//-----------------------------------------------------------------------------------------------------------
new gHeroID;
new bool:gHasMedic[SH_MAXSLOTS+1];
new msgSync;
//new bool:gPlayerInCooldown[SH_MAXSLOTS+1];
new gPcvarLevel, gPcvarHp, gPcvarHpPerS, gPcvarRefreshTime, gPcvarHudOn;//, gPcvarCoolDown, gPcvarHpGive;
//-----------------------------------------------------------------------------------------------------------
public plugin_init()
{
register_plugin("SUPERHERO Medic", "1.0", "Atspulgs");
//Cvar registration
gPcvarLevel = register_cvar("medic_level", "0");
gPcvarHp = register_cvar("medic_heal", "2");
gPcvarHpPerS = register_cvar("medic_heal_timer", "5.0");
//gPcvarHpGive = register_cvar("medic_give_hp", "100");
//gpcvarCoolDown = register_cvar("medic_cooldown", "45");
gPcvarRefreshTime = register_cvar("medic_hud_timer", "1.0");
gPcvarHudOn = register_cvar("medic_hud_on", "1");
//Creates hero and heros info
gHeroID = sh_create_hero("Medic", gPcvarLevel);
sh_set_hero_info(gHeroID, "heals team-mates", "heals tem-mates");
//sh_set_hero_bind(gHeroID);
//Registers heros init
register_srvcmd("medic_init", "medic_init", -1, " ");
shRegHeroInit("Medic", "medic_init");
msgSync = CreateHudSyncObj();
set_task(Float:get_pcvar_float(gPcvarHpPerS), "heal_loop", _, _, _, "b");
set_task(Float:get_pcvar_float(gPcvarRefreshTime), "hud_refresh", _, _, _, "b");
}
//-----------------------------------------------------------------------------------------------------------
public sh_hero_init(id, heroID, mode)
{
if(gHeroID != heroID && !is_user_alive(id))
{
return;
}
gHasMedic[id] = ( mode != SH_HERO_DROP );
}
//-----------------------------------------------------------------------------------------------------------
public heal_loop()
{
if(!sh_is_active())
{
return;
}
new i, j, players[2][SH_MAXSLOTS], num, team, tCounter = 0, ctCounter = 0, count = 0;
get_players(players[0],num,"ah");
for(j=1; j<num; j++)
{
if(gHasMedic[players[0][j]])
{
team = get_user_team(players[0][j]);
if(team == 1)
{
tCounter = tCounter + 1;
}
else if(team == 2)
{
ctCounter = ctCounter + 1;
}
}
}
if(ctCounter >= 1 && tCounter >= 1)
{
get_players(players[1],num,"ah");
if(ctCounter < 2 && tCounter > 1)
{
count = 1;
}
else if(ctCounter > 1 && tCounter < 2)
{
count = 2;
}
else if (ctCounter > 1 && tCounter > 1)
{
count = 3;
}
}
else if(tCounter >= 1 && ctCounter == 0)
{
get_players(players[1],num,"aeh", "T");
if(tCounter > 1)
{
count = 1;
}
}
else if(tCounter == 0 && ctCounter >= 1)
{
get_players(players[1],num,"aeh", "CT");
if(ctCounter > 1)
{
count = 2;
}
}
else
{
return;
}
for(i=1; i<num; i++)
{
if(gHasMedic[players[1][i]])
{
if(count == get_user_team(players[1][i]) || count == 3)
{
sh_add_hp(players[1][i], get_pcvar_num(gPcvarHp));
}
}
else
{
sh_add_hp(players[1][i], get_pcvar_num(gPcvarHp));
}
}
}
//-----------------------------------------------------------------------------------------------------------
public hud_refresh()
{
if(get_pcvar_num(gPcvarHudOn) == 0)
{
return;
}
new i, j, players[SH_MAXSLOTS], num, names[SH_MAXSLOTS][3][32], teamCheck, position, message[1024];
get_players(players, num, "ah");
for(i=1; i<num; i++)
{
if(gHasMedic[players[i]])
{
position += format(message[position], sizeof message - 1 - position, "Team-Mates ................... HP / MaxHP");
teamCheck = get_user_team(players[i]);
for(j=1; j<num; j++)
{
if(teamCheck == get_user_team(players[j]) && !players[i])
{
get_user_name(players[j],names[j][0],31);
if(!is_user_alive(players[j]))
{
copy(names[j][1], 4, "Dead");
copy(names[j][2], 4, "Dead");
}
else
{
names[j][1][0] = get_user_health(players[j]);
names[j][2][0] = sh_get_max_hp(players[j]);
}
position += format(message[position], sizeof message - 1 - position, "^n%s . %i . %i",
names[j][0], names[j][1][0], names[j][2][0]);
}
}
if(teamCheck == 1)
{
set_hudmessage(200, 10, 0, 0.2, 0.7, 0, Float:get_pcvar_float(gPcvarRefreshTime) * 2,
Float:get_pcvar_float(gPcvarRefreshTime) *2, 0.1, 0.1, -1);
}
else
{
set_hudmessage(10, 0, 200, 0.2, 0.7, 0, Float:get_pcvar_float(gPcvarRefreshTime) * 2,
Float:get_pcvar_float(gPcvarRefreshTime) *2, 0.1, 0.1, -1);
}
ShowSyncHudMsg(players[i],msgSync,message);
}
}
}
I need someone to look trough my code and try finding some mistakes i have made, because it compiles fine and it loads fine in the server but it just doesnt do anything (so it appears).