checkin coords
#1

-1567.9929,-2729.8674,48.7435,278.3784

how would i write:
if playercoords is those coords, give 5 free score points.

Reply
#2

well, it's almost imposible to be on exact those coords, so you better use the PlayerToPoint-function.

Код:
SetTimer("CheckPos", 100, 1);
Код:
forward CheckPos();
public CheckPos()
{
  for(new i; i<MAX_PLAYERS; i++)
  {
    if(PlayerToPoint(0.1, i, -1567.9929,-2729.8674,48.7435)
    {
      SetPlayerScore(i, (GetPlayerScore(i)+5));
    }
  }
}
Код:
PlayerToPoint(Float:radius, playerid, Float:X, Float:Y, Float:Z)
{
  new Float:oldpos[3], Float:temppos[3];
  GetPlayerPos(playerid, oldpos[0], oldpos[1], oldpos[2]);
  temppos[0] = (oldpos[0] -X);
  temppos[1] = (oldpos[1] -Y);
  temppos[2] = (oldpos[2] -Z);
  if(((temppos[0] < radius) && (temppos[0] > -radius)) && ((temppos[1] < radius) && (temppos[1] > -radius)) && ((temppos[2] < radius) && (temppos[2] > -radius)))
  {
    return true;
  }
  return false;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)