SA-MP Forums Archive
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: isplayerinarea (/showthread.php?tid=70833)

Pages: 1 2


isplayerinarea - Headshot1108 - 28.03.2009

hi i have a strange problem

i use isplayerinarea and its only at this zone work:

pawn Код:
forward AreaCheck();
public AreaCheck()
{
  for(new i=0; i<MAX_PLAYERS; i++)
  {
    if(IsPlayerInArea(i, -1861.632, 436.2632, -1626.008, 629.5665))
    {
      if(IsPlayerInAnyVehicle(i))
      {
      SetVehicleHealth(GetPlayerVehicleID(i),9999);
      }
    }
  }
}
i try to add a other zone with xtreme visual mapper, but when i paste the coordinate from the visual mapper its dont work...

i dont get infinity vehicle health..

thx and srry for my bad english


Re: isplayerinarea - Headshot1108 - 28.03.2009

help?


Re: isplayerinarea - DMSOrg - 28.03.2009

Hello. I apoligize that nobody has answered your question yet. The problem is that nothing is calling the function. In OnGameModeInit(), insert this code:

pawn Код:
SetTimer("AreaCheck", 500, 1);
hope that helped. I may have the fields switched a bit though (I am not good with timers)


Re: isplayerinarea - Headshot1108 - 28.03.2009

hmm thx for you reply

but that not help me

i have already SetTimer("AreaCheck", 1000, 1);

i've forgotten to say.


Re: isplayerinarea - Headshot1108 - 28.03.2009

help?


Re: isplayerinarea - hazdog - 28.03.2009

SetTimer("AreaCheck",500,true);

//above on gamemode init


Re: isplayerinarea - Headshot1108 - 28.03.2009

Quote:
Originally Posted by Headshot1108
i have already SetTimer("AreaCheck", 1000, 1);

i've forgotten to say.



Re: isplayerinarea - On_Top_Non_Stop - 28.03.2009

You must have the coordinates mixed up. Try re doing them and see if it helps.


Re: isplayerinarea - MenaceX^ - 28.03.2009

Try it with PlayerToPoint instead. If it works with PlayerToPoint, your coords aren't correct.


Re: isplayerinarea - bogeymanEST - 28.03.2009

IsPlayerInArea definition:
pawn Код:
stock IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    if (x > minx && x < maxx && y > miny && y < maxy) return 1;
    return 0;
}
Note the argument order: minx, maxx, miny, maxy
You have set them to: maxx, miny, minx, maxy
So change
pawn Код:
if(IsPlayerInArea(i, -1861.632, 436.2632, -1626.008, 629.5665))
to
pawn Код:
if(IsPlayerInArea(i, -1626.008, -1861.632, 436.2632, 629.5665))



Re: isplayerinarea - [M2S]moe - 28.03.2009

Its amazing that most people "helping" have no idea what they're saying...

Keep everything as you had it before, and add "return 1;" at the end of your function (public functions using a timer people?)

That should fix it.


Re: isplayerinarea - Headshot1108 - 28.03.2009

Quote:
Originally Posted by bogeyman_EST
IsPlayerInArea definition:
pawn Код:
stock IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    if (x > minx && x < maxx && y > miny && y < maxy) return 1;
    return 0;
}
Note the argument order: minx, maxx, miny, maxy
You have set them to: maxx, miny, minx, maxy
So change
pawn Код:
if(IsPlayerInArea(i, -1861.632, 436.2632, -1626.008, 629.5665))
to
pawn Код:
if(IsPlayerInArea(i, -1626.008, -1861.632, 436.2632, 629.5665))
hmm, did i really have so a bad english, that nobody understand me?

this:

pawn Код:
if(IsPlayerInArea(i, -1861.632, 436.2632, -1626.008, 629.5665))
is work...

i say, when i paste a other position from the xtreme visual mapper: http://forum.sa-mp.com/index.php?topic=14702.0
that dont work, although i define the zone with xtreme visual mapper.

@moe:

thx, but dont work


Re: isplayerinarea - [M2S]moe - 28.03.2009

if it doesnt work your coordinates are wrong


Re: isplayerinarea - Headshot1108 - 28.03.2009

i think not, because i have do a gang zone, and its work.


Re: isplayerinarea - Headshot1108 - 28.03.2009

ok, here are the coordinates.

1653.387, -2771.438, 2341.7, -2396.403

when i do this at gangzone, i see the gangzone, but when i put this in isplayerinarea its dont work.

pawn Код:
forward AreaCheck();
public AreaCheck()
{
  for(new i=0; i<MAX_PLAYERS; i++)
  {
    if(IsPlayerInArea(i, 1653.387, -2771.438, 2341.7, -2396.403))
    {
      if(IsPlayerInAnyVehicle(i))
      {
      SetVehicleHealth(GetPlayerVehicleID(i),9999);
      }
    }
  }
}



please help


Re: isplayerinarea - [M2S]moe - 28.03.2009

Show me public IsPlayerInArea


Re: isplayerinarea - FUNExtreme - 28.03.2009

Quote:
Originally Posted by [M2S
moe ]
Its amazing that most people "helping" have no idea what they're saying...
...
(public functions using a timer people?)
...
Learn to script before you start "helping"(see above)


Re: isplayerinarea - Nero_3D - 28.03.2009

Quote:
Originally Posted by Headshot1108
ok, here are the coordinates.

1653.387, -2771.438, 2341.7, -2396.403
Xtreme visual mapper put the cordinates in the maxX, minX, maxY, minY oder
And you got the function in the minX, maxX, minY, maxY
So just swap it a bit to

-2771.438, 1653.387, -2396.403, 2341.7

Offtopic

Quote:
Originally Posted by FUNExtreme
Quote:
Originally Posted by [M2S
moe ]
Its amazing that most people "helping" have no idea what they're saying...
...
(public functions using a timer people?)
...
Learn to script before you start "helping"(see above)
Ignore them, there are always people who thinks they know everythings better (even it isnt true)


Re: isplayerinarea - Headshot1108 - 29.03.2009

Quote:
Originally Posted by ♣ ⓐⓢⓢ
Quote:
Originally Posted by Headshot1108
ok, here are the coordinates.

1653.387, -2771.438, 2341.7, -2396.403
Xtreme visual mapper put the cordinates in the maxX, minX, maxY, minY oder
And you got the function in the minX, maxX, minY, maxY
So just swap it a bit to

-2771.438, 1653.387, -2396.403, 2341.7

Offtopic

Quote:
Originally Posted by FUNExtreme
Quote:
Originally Posted by [M2S
moe ]
Its amazing that most people "helping" have no idea what they're saying...
...
(public functions using a timer people?)
...
Learn to script before you start "helping"(see above)
Ignore them, there are always people who thinks they know everythings better (even it isnt true)
hmm, dont work...

my isplayerinare is this:

stock IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy)
{
new Float, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if (x > minx && x < maxx && y > miny && y < maxy) return 1;
return 0;
}


Re: isplayerinarea - Nero_3D - 29.03.2009

Quote:
Originally Posted by Headshot1108
hmm, dont work...

my isplayerinare is this:

stock IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy)
{
new Float, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if (x > minx && x < maxx && y > miny && y < maxy) return 1;
return 0;
}
I just need to say Xtreme Vehicle Plotter wasnt made for IsPlayerInArea, it was made for WorldBounds and GangZones
So if you only copy the cords it surly wont work
Ok just say what you did, you selected an area, right ?
What option you took ? Vehicle / Player Spawn / Gang Zone & World Boundaries / Teleports and Objects / Pickups and Checkpoints

The easiest way is just to go in game in take two corners (of the area) and put it in the right order ... omfg people help yourself