Raised This Month: $ Target: $400
 0% 

Team healing


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
egbertjan
Senior Member
Join Date: Mar 2007
Location: The Netherlands
Old 07-26-2011 , 11:24   Team healing
Reply With Quote #1

Hello, I got some problems with a team heal function.

Code:
//init
    register_cvar("diablo_Monk_heal", "20")
    register_cvar("diablo_Monk_distance", "300")

// my task
        case Monk:
        {
            Monk_healteam(id)
            
        }

public Monk_healteam(id) {

    new team1 = get_user_team(id);
    new team2;
    new p_origin[3], t_origin[3];
    get_user_origin(id, p_origin);

    for(new i = 0; i < 3; i++) {
        team2 = get_user_team(i);
        if(team2 != team1 && is_user_alive(i)) {
            get_user_origin(i, t_origin);
            if(get_distance(p_origin, t_origin) <= get_cvar_num("diablo_Monk_distance")) {
                set_user_health(i, get_user_health(i)+get_cvar_num("diablo_Monk_heal"));
                show_hudmessage(i, "You have healed your team for %i HP within %i feet",get_cvar_num("diablo_Monk_heal"),get_cvar_num("diablo_Monk_distance")) 
            } else {
            show_hudmessage(i, "You have to get closer to your team mates to heal them!") 
            
            }    
        }
    }
}
I have a task for running this function, but I don't know what's wrong with this.

I'm started to understand some basics of scripting, but still there are many things I have to learn, so please if you see what's wrong also explain me why it was wrong.

Edit: There are no compiling errors, just when I do the task it doesn't do anything.

Thanks in advance!

Last edited by egbertjan; 07-26-2011 at 11:30.
egbertjan is offline
 



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 01:07.


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