Help with is player in range of area
#1

Hello guys , after following a tutorial here on how to check if player is in area
i have this piece of code :
pawn Код:
stock IsPlayerInArea(playerid, Float:MinX, Float:MinY, Float:MaxX, 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 1;
}
CMD:afk
{
    if(IsPlayerInArea(playerid, 201.4599, 1858.0775, 257.3467, 1833.5784)) return SendClientMessage(playerid,COLOR_RED,"Sorry but you can not use this command here");
return1;
}
but now when i use afk command even if i am not at the area it stops it.
any help please? :/
Reply
#2

pawn Код:
stock IsPlayerInArea(playerid, Float:MinX, Float:MinY, Float:MaxX, 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;}else{return 0;}
}
CMD:afk
{
    if(IsPlayerInArea(playerid, 201.4599, 1858.0775, 257.3467, 1833.5784)) return SendClientMessage(playerid,COLOR_RED,"Sorry but you can not use this command here");
return 1;
}
Reply
#3

Still same problem sir :/
Reply
#4

Bump
Reply
#5

Hm, try this:
pawn Код:
stock IsPlayerInArea(playerid, Float:MinX, Float:MinY, Float:MaxX, 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;}else{return 0;}
}
CMD:afk
{
    if(IsPlayerInArea(playerid, 201.4599, 1833.5784, 257.3467, 1858.0775)) return SendClientMessage(playerid,COLOR_RED,"Sorry but you can not use this command here");
    //Reverse MinY and MaxY coordinates
    return 1;
}
Reply
#6

No still same :/
Reply
#7

Why don't you use IsPlayerInRangeOfPoint?
Reply
#8

How to use it while i want to check an area? :O
Reply
#9

Just search..
wiki.sa-mp.com/wiki/IsPlayerInRangeOfPoint
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)