Need help again
#4

Put this next to your forward's
pawn Код:
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
Put this anywhere in the script.
pawn Код:
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
    new Float:oldposx, Float:oldposy, Float:oldposz;
    new Float:tempposx, Float:tempposy, Float:tempposz;
    GetPlayerPos(playerid, oldposx, oldposy, oldposz);
    tempposx = (oldposx -x);
    tempposy = (oldposy -y);
    tempposz = (oldposz -z);
    //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
    if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
    {
        return 1;
    }
    return 0;
}
Put this in OnPlayerCommandText.
pawn Код:
if (strcmp("/duty", cmdtext, true, 10) == 0)
{
   if(PlayerToPoint(4.0, playerid, X, Y, Z))
   {
     //your code here.
   }
}
Reply


Messages In This Thread
Need help again - by Namaco - 24.06.2009, 18:06
Re: Whats Wrong? - by Namaco - 24.06.2009, 18:06
Re: Need help again - by NigNog1 - 24.06.2009, 20:49
Re: Need help again - by Stah - 24.06.2009, 21:22

Forum Jump:


Users browsing this thread: 1 Guest(s)