Check if player is close to checkpoint, then show it
#2

pawn Код:
public OnFilterScriptInit() {
    SetTimer("CheckPlayers", 1000, true);
}

forward CheckPlayers();
public CheckPlayers() {
    for(new i=0; i<MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i)) {
            if(PlayerToPoint(10, cehckpointX, cehckpointY, cehckpointZ) {
                SendClientMessage(playerid, 0xFFFF00AA, "Get into the checkpoint");
            }
        }
    }
}
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
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);
  if(((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  {
    return 1;
  }
  return 0;
}
Reply


Messages In This Thread
Check if player is close to checkpoint, then show it - by Robbin237 - 19.02.2009, 10:00
Re: Check if player is close to checkpoint, then show it - by joco96 - 19.02.2009, 10:53
Re: Check if player is close to checkpoint, then show it - by Robbin237 - 19.02.2009, 11:00
Re: Check if player is close to checkpoint, then show it - by joco96 - 19.02.2009, 11:03
Re: Check if player is close to checkpoint, then show it - by Robbin237 - 19.02.2009, 11:04
Re: Check if player is close to checkpoint, then show it - by trc_ - 19.02.2009, 11:13

Forum Jump:


Users browsing this thread: 1 Guest(s)