[Include] [INC] Areas
#1


Description
This script will allows you to create easily area, for one player or for all palyers

Functions
Code:
CreateArea(Float:minX, Float:maxX, Float:minY, Float:maxY); // Create area for all players, return id of the zone or INVALID_AREA if the number of maximum area is reached
DestroyArea(areaid); // Destroy area, return true if the area has been destroyed, false if the id is incorrect or that the area was not created
IsPlayerInArea(playerid, areaid); //Check if a player is in the 'areaid', return: true if the player is in area, false if not in area
GetPlayerInArea(playerid); //return: the id of the area in which is the player, INVALID_AREA if the player is not in an area
SetPlayerInArea(playerid,areaid); //Place the player in the center of the area, return: true if the player has been placed in the area, false if the id of the zone is incorrect or that the area was not created

 // The following function returns the same as their equivalent in area for all player
CreatePlayerArea(playerid,Float:minX, Float:maxX, Float:minY, Float:maxY);
DestroyPlayerArea(playerid,areaid);
IsPlayerInPlayerArea(playerid, areaid);
GetPlayerInPlayerArea(playerid);
SetPlayerInPlayerArea(playerid,areaid);
Download
V1.0


Install

- Place the file 'areas.inc' in your folder /pawno/include
- Add '# include <areas>' at the top of your gamemode
- Add 'AR_OnGameModeInit();' At the top of the 'OnGameModeInit'
- Add 'AR_OnGameModeExit();' in 'OnGameModeExit'
- Add 'AR_OnPlayerConnect(playerid)'; in 'OnPlayerConnect'
- Add 'AR_OnPlayerDisconnect(playerid)'; in 'OnPlayerDisconnect'
- Add at the bottom of your script this:
pawn Code:
public OnPlayerEnterArea(playerid,areaid)
{
    return 1;
}
public OnPlayerExitArea(playerid,areaid)
{
    return 1;
}
public OnPlayerEnterPlayerArea(playerid,areaid)
{
    return 1;
}
public OnPlayerExitPlayerArea(playerid,areaid)
{
    return 1;
}

Reply
#2

very very nice
Reply
#3

Good work.
Reply
#4

well done , is going to be useful
Reply
#5

awesome, it is absolutely extravagent!!! (lolz)
Reply
#6

This is very good INC but, this does not work. You give examples ?
Reply
#7

I swear I've seen these same exact functions before.
*Swift_ goes searching.
Reply
#8

Nice DUDE
Reply
#9

Where is the link ?
Reply
#10

Quote:
Originally Posted by Emrets61
Where is the link ?
Quote:
Originally Posted by Emrets61
This is very good INC but, this does not work. You give examples ?
Reply
#11

The link is the image, then click on the image of the file

For an example I ferris tomorrow.
Reply
#12

I added codes:

[code=Up]#include <areas>[/code]

[code=OnGameModeInit]
public OnGameModeInit()
{
AR_OnGameModeInit();
return 1;
}[/code]

[code=OnGameModeExit]
public OnGameModeExit()
{
AR_OnGameModeExit();
return 1;
}[/code]

[code=OnPlayerConnect]
public OnPlayerConnect(playerid)
{
AR_OnPlayerConnect(playerid);
return 1;
}[/code]

[code=OnPlayerDisconnect]
public OnPlayerDisconnect(playerid)
{
AR_OnPlayerDisconnect(playerid);
return 1;
}[/code]

[code=OnPlayerSpawn]
public OnPlayerSpawn(playerid)
{
TatilAlani = CreateArea(-2942.825, -2954.502, 2954.502, -2907.791);
return 1;
}[/code]

[code=OnPlayerEnterArea]public OnPlayerEnterArea(playerid,areaid)
{
if(IsPlayerInArea(playerid, TatilAlani))
{
SetPlayerPos(playerid,-2203.3171,-2771.0288,35.5669);
SetPlayerFacingAngle(playerid,75.036;
SendPlayerFormattedText(playerid, "Tatil alanına girebilmek iзin bilet almalısınız.", 0);
}
return 1;
}
[/code]

But not work !
Reply
#13

So.. Does anybody tested this?
Reply
#14

I creating mode for my server. This mode is really important. In the short time period must be published. Give you example? Please.
Reply
#15

GetPlayerInArea must be GetAreaOfPlayer or GetPlayerArea, I think.
Reply
#16

I added:

pawn Код:
public OnPlayerEnterArea(playerid,areaid)
{
    GetPlayerInArea(playerid);
    if(IsPlayerInArea(playerid, TatilAlani))
    {
    SetPlayerPos(playerid,-2203.3171,-2771.0288,35.5669);
    SetPlayerFacingAngle(playerid,75.0368);
    SendPlayerFormattedText(playerid, "Tatil alanına girebilmek iзin bilet almalısınız.", 0);
    }
    return 1;
}
Not work !
Reply
#17


At the top of your script:
pawn Код:
new TatilAlani;
In OnGameModeInit or elsewhere
pawn Код:
TatilAlani = CreateArea(/*The coordinated minX, maxX, minY, maxY*/);
pawn Код:
public OnPlayerEnterArea(playerid,areaid)
{
    if(areaid == TatilAlani)
    {
      SetPlayerPos(playerid,-2203.3171,-2771.0288,35.5669);
      SetPlayerFacingAngle(playerid,75.0368);
      SendPlayerFormattedText(playerid, "Tatil alanına girebilmek iзin bilet almalısınız.", 0);
    }
    return 1;
}
GetPlayerInArea return areaid in which the player, it can for example be used in a command such as:

pawn Код:
if(strcmp(cmd,"/mycmd",true) == 0)
{
   if(GetPlayerInArea(playerid) != TatilAlani)
   {
      SendClientMessage(playerid,0xFFFFFFFF,"Not in area TatilAlani!");
      return 1;
   }
}
Reply
#18

I really thank you very much.
Reply
#19

Not work.
Reply
#20

Your coordinate are can be incorrect
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)