isplayerinarea
#1

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
Reply
#2

help?
Reply
#3

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)
Reply
#4

hmm thx for you reply

but that not help me

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

i've forgotten to say.
Reply
#5

help?
Reply
#6

SetTimer("AreaCheck",500,true);

//above on gamemode init
Reply
#7

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

i've forgotten to say.
Reply
#8

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

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

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))
Reply
#11

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.
Reply
#12

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
Reply
#13

if it doesnt work your coordinates are wrong
Reply
#14

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

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
Reply
#16

Show me public IsPlayerInArea
Reply
#17

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)
Reply
#18

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)
Reply
#19

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;
}
Reply
#20

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)