Function [+REP]
#1

Hello Everyone i want to create a Function which checks that if a player is at land..

This is My command by which I can edit Land:

PHP код:
CMD:lands(playeridparams[])
{
    new 
playername[MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayernamesizeof(playername));
    for(new 
xMAX_LANDSx++)
    {
        if([
COLOR=Red"]""""""""""[/COLOR](playerid, LandInfo[x][landZone]))
        {
               if(strcmp(playername, LandInfo[x][landOwner], true) == 0)
            {
                editingLand[playerid] = x;
                break;
            }
            else
            {
                editingLand[playerid] = -1;
            }
        }
    }
    ShowPlayerDialogEx(playerid, LANDSMAIN,DIALOG_STYLE_LIST, "
Lands Select an option", "Toggle Lands on Map\nBuild\nEdit a Building\nDestroy a Building\nBuy Land\nSell Land\nDestroy all objects", "Select", "Cancel");
    return 1;

There at """"""" (red Colored) I want to create a Function which checks that if a player is in its land and if the player is not in land it should show player message that You are not in your Land, and if the player is in its land boundaries then it should allow player to edit land.

Necessary Info:

Код:
        Float: landMinX,
	Float: landMinY,
	Float: landMaxX,
	Float: landMaxY,
        landZone
Reply
#2

It can be done with IsPlayerInRangeOfPoint, I can make it but I don't know your coordinate variables
Reply
#3

coordinates that why i cant make it... there are no coordinates, we just have to make land in game which is not a point. It has 4 boundaries (east, west, north, south) and i want to make a function that checks if a player is in that boundary.
Reply
#4

Quote:
Originally Posted by Alpha000
Посмотреть сообщение
coordinates that why i cant make it... there are no coordinates, we just have to make land in game which is not a point. It has 4 boundaries (east, west, north, south) and i want to make a function that checks if a player is in that boundary.
You can't detect if player is in boundaries, but you can only set boundaries

How exactly your system is working?
Reply
#5

You must have seen land system in lawless RP... mine is like that but i have no idea that how can i check if a player is in his land... Otherwise player can make land objects everywhere.
Reply
#6

You can use:
https://sampwiki.blast.hk/wiki/SetPlayerWorldBounds

To limit a player to a certain area.

And you can also use:

PHP код:
IsPlayerInArea(playeridFloat:MinXFloat:MinYFloat:MaxXFloat:MaxY)
{
    new 
Float:XFloat:YFloat:Z;
    
GetPlayerPos(playeridXYZ);
    if(
>= MinX && <= MaxX && >= MinY && <= MaxY) {
        return 
1;
    }
    return 
0;

To check if the player is inside his land.
Reply
#7

i have a question....
Is there any way by which i can set player to stay in land boundaries...like in SetPlayerWorldBounds i have to set boundaries but i want to set his land boundaries instead of adding coordinates. like my land boundaries are Float: landMinX,
Float: landMinY,
Float: landMaxX,
Float: landMaxY,
Reply
#8

You aren't making much sense. That's precisely what SetPlayerWorldBounds does. I personally don't like that function though.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)