SA-MP Forums Archive
how to check if a player is outside an 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: how to check if a player is outside an area? (/showthread.php?tid=187158)



how to check if a player is outside an area? - Owenlishious - 01.11.2010

hello,

this is kinda my first time working with areas and weather is the player is inside in area or not. So im kinda lost...

for example: when the player is inside an area, it should say you have 10 seconds to leave.

Then when you enter again it restarts the countdown.

I dont have any problems with the countdown msg ... i just dont know how to check if a player is outside an area.

heres what i have so far:






public OnGameModeInit()
{
SetTimer("a51check",1000,1);
return 1;
}






forward a51check();
public a51check()
{
for(new P=0; P < MAX_PLAYERS; P++)
{
if (IsPlayerConnected(P))
{
if(acount[P] <= 0)
{
acount[P] = 11;

return 1;
}

if(IsPlayerInCube(P, 97.0170,1799.1124,-57.8426,285.2727,1940.9764,281.8122))
{
acount[P] --;
new string[280];
format(string,sizeof(string),"You have %d seconds to get out",acount[P]);
GameTextForPlayer(P,string,1000,5);
return 1;
}

if(!IsPlayerInCube(P, 97.0170,1799.1124,-57.8426,285.2727,1940.9764,281.8122))
{
acount[P] = 11;
return 1;
}
}
}

return 1;
}


Re: how to check if a player is outside an area? - SampStunta - 01.11.2010

GetPlayerInterior
or
GetPlayerPos

But GetPlayerPos only gers their exact position.


Re: how to check if a player is outside an area? - Bessensap - 01.11.2010

if(!IsPlayerInArea(playerid,minx,maxx,miny,maxy);

meaning, he's not in the area