IsPlayerInRangeOfPoint
#1

im trying to make a Medic Player
so i got this
pawn Code:
//At the top
new Float:Hx[MAX_PLAYERS],Float:Hy[MAX_PLAYERS],Float:Hz[MAX_PLAYERS];
new healid[MAX_PLAYERS];


//then i got this
public OnPlayerUpdate(playerid)
{
new Float:Health;
GetPlayerHealth(playerid,Health);
if(Health<=10 && NeedHeal[playerid]<=2)
{
    ApplyAnimation(playerid,"SWEET","Sweet_injuredloop",4.1,1,0,0,0,0,0);
    if(NeedHeal[playerid]==0)
        {
            TogglePlayerControllable(playerid,false);
            GetPlayerPos(playerid,Hx[playerid],Hy[playerid],Hz[playerid]);
            Heal[playerid] = CreatePickup(1318, 23, Hx[playerid], Hy[playerid], Hz[playerid]+2, -1);
            playerid = healid[playerid];
        }
    NeedHeal[playerid] ++;
}
}


//And for te medic to type /Heal
COMMAND:heal(playerid, params[])
{
LoadPlayerClass(playerid);
if(!strcmp("Medic",ClassInfo,true))
    {
    if(IsPlayerInRangeOfPoint(playerid, 10.0, Hx[playerid], Hy[playerid], Hz[playerid]))
        {
            ApplyAnimation(playerid,"MEDIC","CPR",4.1,0,1,1,1,1);
            SetTimer("HealPlayer",3000,false);
        }else return SendClientMessage(playerid,RED,"There Is No Player's To Heal Near You");
    }
return 1;
}


//then the timer
forward HealPlayer(playerid);
public HealPlayer(playerid)
{
for(new i; i < MAX_PLAYERS; i ++)
    {
    TogglePlayerControllable(healid[i],true);
    ClearAnimations(healid[i]);
    DestroyPickup(Heal[i]);
        SetPlayerHealth(healid[i],100);
    }
}
the problem is that it comes up with There Is No Player's To Heal Near You
and i dont even know if the other things are going to work. Need alot of hel pPLS
Reply
#2

You're co-ordinates are wrong,

Write GetPlayerPos inside the command and have it for a specific person, and use sscanf if too, or you have to use the ordinary params[] parameter.

EDIT: Write a forloop for this IsPlayerInRangeOfPoint((FORLOOPNAME), ... );
Reply
#3

Quote:
Originally Posted by Lorenc_
View Post
You're co-ordinates are wrong,

Write GetPlayerPos inside the command and have it for a specific person, and use sscanf if too, or you have to use the ordinary params[] parameter.

EDIT: Write a forloop for this IsPlayerInRangeOfPoint((FORLOOPNAME), ... );
yhyh that would work thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)