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!