SA-MP Forums Archive
Error IsPlayerInArea - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Error IsPlayerInArea (/showthread.php?tid=156927)



Error IsPlayerInArea - Freddy Z - 24.06.2010

pawn Код:
public OnGameModeInit()
{
  if(IsPlayerInArea(playerid,2690,2720,2740,2770,100);
  SetPlayerCheckpoint(playerid, 1982.6150, -220.6680, -0.2432, 3.0);
}

pwn(380) : error 017: undefined symbol "IsPlayerInArea"
pwn(380) : error 001: expected token: ")", but found ";"
pwn(380) : error 036: empty statement
pwn(380) : fatal error 107: too many error messages on one line




Re: Error IsPlayerInArea - MastahServers - 24.06.2010

In the top of your script:

pawn Код:
forward isPlayerInArea();
In your filter-/gamemode init:

pawn Код:
SetTimer("isPlayerInArea", 1000, 1);
In the bottom of your script:

pawn Код:
public isPlayerInArea()
  {
    new Float:X, Float:Y, Float:Z;
    for(new i=0; i < MAX_PLAYERS; i++)
    {
      GetPlayerPos(i, X, Y, Z);
      if (X <= [max X-coor.] && X >= [max X-coor.] && Y <= [max Y-coor.] && Y >= [max Y-coor.])
    }
  }
* coor. = coordinates

To get the coordinates, use;
pawn Код:
if (strcmp("/pos", cmdtext, true) == 0)
  {
    new string1[256];
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid,X,Y,Z);
    format(string1,sizeof(string1),"Position = X: %.0f , Y: %.0f , Z: %.0f",X,Y,Z);
    SendClientMessage(playerid,COLOR_GREEN,string1);
    return 1;
  }