When the player leave from area (+Rep) -
Trynda - 22.05.2014
Hello!
How do i make when player leave from 30 radius or 20, There will be an execution will happen
For instance:
Your robbing the bank and you exit/leave the bank area then you will be failed robbing the bank, How? thanks!!!
I promise i will give an rep
Re: When the player leave from area (+Rep) -
ball - 22.05.2014
1. Use y_areas
2. SetTimer + Loop + IsPlayerInArea
For one area i prefer option number 2, but if you have more areas use y_areas - it is easy to use.
Re: When the player leave from area (+Rep) -
Lordzy - 22.05.2014
You can create areas to be checked. Using an array would avoid area checking getting spammed. So when a player exist on an area or when a player enters the area, the array could be set to a value. And when the player leaves the area, it could be changed to another value.
https://sampwiki.blast.hk/wiki/Areacheck
You can also use Incognito's streamer which supports area detection.
Re: When the player leave from area (+Rep) -
Trynda - 22.05.2014
Any examples please
Re: When the player leave from area (+Rep) -
NoSoap - 22.05.2014
You could always use
https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint
And made it so if it equalled false, then something happens.
Personally I'd find that easier to do than areas, as you can still use a radius.
Re: When the player leave from area (+Rep) -
Trynda - 22.05.2014
Quote:
Originally Posted by NoSoap
|
Thats what im planning to do , but how
Re: When the player leave from area (+Rep) -
Mark_Weston - 22.05.2014
Quote:
Originally Posted by Trynda
Thats what im planning to do , but how 
|
Quote:
if(!strcmp("/stadium",cmdtext))
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 2695.6880, -1704.6300, 11.843 )
{
SendClientMessage(playerid,0xFFFFFFFF,"You are near the stadium entrance!");
}
return 1;
}
|
if(IsPlayerInRangeOfPoint(playerid, range in radius, X, Y, Z))
Re: When the player leave from area (+Rep) -
Trynda - 22.05.2014
Quote:
Originally Posted by Mark_Weston
if(IsPlayerInRangeOfPoint(playerid, range in radius, X, Y, Z))
|
ye, i know but, what code do i input when player leave on that radius thing
Re: When the player leave from area (+Rep) -
Pasa - 22.05.2014
There is no need for a timer because in samp exists areas where you can use a callback "OnPlayerLeaveDynamicArea" (streamer is required)
Example:
Code:
new areaID, zona;
public OnGameModeInit()
{
areaID = CreateDynamicRectangle(0.0, 0.0, 50.0, 50.0);
zona = GangZoneCreate(0.0, 0.0, 50.0, 50.0);
GangZoneShowForAll(zona, G_RED);
return 1;
}
public OnPlayerLeaveDynamicArea(playerid, areaid) {
if(areaid == areaID) {
SendClientMessage(playerid, -1, "You have leaved that area!");
}
return 1;
}
public OnPlayerEnterDynamicArea(playerid, areaid) {
if(areaid == areaID) {
SendClientMessage(playerid, -1, "You have entered that area!");
}
return 1;
}
EDIT: to pick the cordinates you save the cordinates of the diagonal of your rectangle or you use
Code:
CreateDynamicCircle(x, y, size)

In my case the saved cordinates are
first point - x = 0, y = 0 (start of the diagonal)
second point - x = 50, y = 50 (end of the diagonal)
SRY for bad english
Re: When the player leave from area (+Rep) -
Vince - 23.05.2014
Quote:
Originally Posted by Lordzy
You can also use Incognito's streamer which supports area detection.
|
This. Extremely easy and it even has a callback OnPlayerLeaveDynamicArea.