Raised This Month: $ Target: $400
 0% 

Need some help with the Code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Atspulgs
Senior Member
Join Date: Mar 2008
Old 06-07-2009 , 16:52   Need some help with the Code
Reply With Quote #1

I know this is not the right place to post it, but recently im not getting any support in SuperHero mod scripting help section.

Also my problem generally lies within hud displaying so i posted it here.

heres the code:
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 gPcvarLevelgPcvarHpgPcvarHpPerSgPcvarRefreshTimegPcvarHudOn;//, 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(idheroIDmode)
{
    if(
gHeroID != heroID && !is_user_alive(id))
    {
        return;
    }

    
gHasMedic[id] = ( mode != SH_HERO_DROP );
}
//-----------------------------------------------------------------------------------------------------------
public heal_loop()
{
    if(!
sh_is_active())
    {
        return;
    }

    new 
ijplayers[2][SH_MAXSLOTS], numteamtCounter 0ctCounter 0count 0;

    
get_players(players[0],num,"ah");
    for(
j=1j<numj++)
    {
        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 >= && tCounter >= 1)
    {
        
get_players(players[1],num,"ah");
        if(
ctCounter && tCounter 1)
        {
            
count 1;
        }
        else if(
ctCounter && tCounter 2)
        {
            
count 2;
        }
        else if (
ctCounter && tCounter 1)
        {
            
count 3;
        }

    }
    else if(
tCounter >= && ctCounter == 0)
    {
        
get_players(players[1],num,"aeh""T");
        if(
tCounter 1)
        {
            
count 1;
        }
    }
    else if(
tCounter == && ctCounter >= 1)
    {
        
get_players(players[1],num,"aeh""CT");
        if(
ctCounter 1)
        {
            
count 2;
        }
    }
    else
    {
        return;
    }

    for(
i=1i<numi++)
        {
        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 
ijplayers[SH_MAXSLOTS], numnames[SH_MAXSLOTS][3][32], teamCheckpositionmessage[1024];

    
get_players(playersnum"ah");
    for(
i=1i<numi++)
    {
        if(
gHasMedic[players[i]])
        {
            
position += format(message[position], sizeof message position"Team-Mates ................... HP / MaxHP");

            
teamCheck get_user_team(players[i]);
            for(
j=1j<numj++)
            {
                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 position"^n%s . %i . %i",
                    
names[j][0], names[j][1][0], names[j][2][0]);
                }
            }
            if(
teamCheck == 1)
            {
                
set_hudmessage(2001000.20.70Float:get_pcvar_float(gPcvarRefreshTime) * 2,
                        
Float:get_pcvar_float(gPcvarRefreshTime) *20.10.1, -1);
            }
            else
            {
                
set_hudmessage(1002000.20.70Float:get_pcvar_float(gPcvarRefreshTime) * 2,
                        
Float:get_pcvar_float(gPcvarRefreshTime) *20.10.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).
__________________
-=DG Ats
DoomedGang web page -
http://www.doomedgang.com
Atspulgs is offline
Atspulgs
Senior Member
Join Date: Mar 2008
Old 06-16-2009 , 07:21   Re: Need some help with the Code
Reply With Quote #2

bump
Its been 9 days and i found this in 7th page
I would really appreciate if someone would take some time and look trough the code as im stuck here. I know its some stupid mistake but i just cant seem to locate it.
__________________
-=DG Ats
DoomedGang web page -
http://www.doomedgang.com
Atspulgs is offline
crazyeffect
Veteran Member
Join Date: Jul 2008
Location: Belgium
Old 06-16-2009 , 07:54   Re: Need some help with the Code
Reply With Quote #3

Not Nine days, 2 weeks
__________________
crazyeffect is offline
Send a message via MSN to crazyeffect
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:59.


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