SA-MP Forums Archive
Help with is player in range of area - 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)
+--- Thread: Help with is player in range of area (/showthread.php?tid=368455)



Help with is player in range of area - CoDeZ - 13.08.2012

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? :/


Re: Help with is player in range of area - IceMeteor - 13.08.2012

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;
}



Re: Help with is player in range of area - CoDeZ - 13.08.2012

Still same problem sir :/


Re: Help with is player in range of area - CoDeZ - 13.08.2012

Bump


Re: Help with is player in range of area - lamarr007 - 13.08.2012

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;
}



Re: Help with is player in range of area - CoDeZ - 13.08.2012

No still same :/


Re: Help with is player in range of area - TaLhA XIV - 13.08.2012

Why don't you use IsPlayerInRangeOfPoint?


Re: Help with is player in range of area - CoDeZ - 13.08.2012

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


Re: Help with is player in range of area - lamarr007 - 13.08.2012

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