Heal Wave Function
#1

I am stuck with creating a function that heals all players within a sphere area.

this is what i have so far.

It only heals the player who has the healtimer set as 1 at the mo

Код:
stock IsPlayerInSphere(playerid,Float:x,Float:y,Float:z,radius) //By Sacky
{
if(GetPlayerDistanceToPointEx(playerid,x,y,z) < radius){
return 1;
}
return 0;
}
stock GetPlayerDistanceToPointEx(playerid,Float:x,Float:y,Float:z) //By Sacky
{
new Float:x1,Float:y1,Float:z1;
new Float:tmpdis;
GetPlayerPos(playerid,x1,y1,z1);
tmpdis = floatsqroot(floatpower(floatabs(floatsub(x,x1)),2)+floatpower(floatabs(floatsub(y,y1)),2)+floatpower(floatabs(floatsub(z,z1)),2));
return floatround(tmpdis);
}


forward healwave(playerid);
public healwave(playerid)
{
 new Float:xpos;
 new Float:ypos;
 new Float:zpos;
 for(new i=0; i<MAX_PLAYERS; i++){
   if(HealTimer[i] == 1){
     GetPlayerPos(i, Float:xpos, Float:ypos, Float:zpos);
   }
   if(IsPlayerInSphere(i, xpos, ypos, zpos, 35)){
     new Float:health;
     GetPlayerHealth(i, health);
     if(health < 89){
       SetPlayerHealth(i, health+Float:10.0);
     }
     else return SetPlayerHealth(i, Float:100.0);
   }
 }
 return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)