Land System
#1

Hello everyone, I just wanted to make a land system, But I'm still dont have such skills, The problem is that I don't know from where to start, or What to use.. I could just need some help, if someone could help, Comment down please..
Reply
#2

Please give us more information on what to help you with.
Reply
#3

Quote:
Originally Posted by Codeah
Посмотреть сообщение
Please give us more information on what to help you with.
Simply, What a land system is, The land system starts by that you own a land with different sizes (Small, Medium, Large) at a specific place which u choose and admins create a land for you in there..

The next step is adding furniture to that land, And furniture is limited and the limit changes as the size changes.

It's simply creating a house for yourself even with walls and ground and every single detail in the house, better than the already mapped interiors, That's it, I will need someone to help me with that quickly.
Reply
#4

You can use gang zones to do this to start with because you want people to buy some land. Hence you can map lands and mark them as gang zones on the map.

A Helpful tutorial on creating gang zones : https://sampforum.blast.hk/showthread.php?tid=610587

Then later you can just add prices sort of system, gangzones are a good way just to map and hence make land available for people to purchase.
Reply
#5

Quote:
Originally Posted by rockhopper
Посмотреть сообщение
You can use gang zones to do this to start with because you want people to buy some land. Hence you can map lands and mark them as gang zones on the map.

A Helpful tutorial on creating gang zones : https://sampforum.blast.hk/showthread.php?tid=610587

Then later you can just add prices sort of system, gangzones are a good way just to map and hence make land available for people to purchase.
Not a bad start but this will fuck me up as i will have to script a zone for each player who is looking up to have a land and i don't want to map it myself, each player make the map of his land just like what he wants, it is like creating gates in game but with different objects ids, but not dynamic gates, i want to male a system which allows the admin to /createland easily and then he can /editland to set the owner and all of that, what shall i write as land enums? Etc..
Reply
#6

There have been many posts like this on the forums. i dont play on Lawless but i can tell by watching their video on ******* that, they are using Custom Functions like, CreateLand(playerid, radius, posx,y,z); (or something like that)
for easy coding. What you do is, store the X,Y,Z in PlayerID's file with a Land ID. that makes him the owner of that Particular Land.

You can use IsAtHisOwnedLand() (or something like this) to check if he is standing on his own land. You can use IsPlayerInRangeOfPoint(playerid, radius of land,X,Y,Z) to check if he is standing with in his land. What others meant to say Use GangZones to display lands on Map.

You can make a Furniture system like, /buyfurniture and check if IsAtHisOwnedLand(), you allow him to create a Object there. if the Object after saying goes out of land area, you DestroyObject() or may be show player a warning.
Reply
#7

Quote:
Originally Posted by GTLS
Посмотреть сообщение
There have been many posts like this on the forums. i dont play on Lawless but i can tell by watching their video on ******* that, they are using Custom Functions like, CreateLand(playerid, radius, posx,y,z); (or something like that)
for easy coding. What you do is, store the X,Y,Z in PlayerID's file with a Land ID. that makes him the owner of that Particular Land.

You can use IsAtHisOwnedLand() (or something like this) to check if he is standing on his own land. You can use IsPlayerInRangeOfPoint(playerid, radius of land,X,Y,Z) to check if he is standing with in his land. What others meant to say Use GangZones to display lands on Map.

You can make a Furniture system like, /buyfurniture and check if IsAtHisOwnedLand(), you allow him to create a Object there. if the Object after saying goes out of land area, you DestroyObject() or may be show player a warning.
Can you show me an example code for storing X,Y,Z and for a basic cmd of creating a zone within the player's position?
Reply
#8

What also should I define and add to player's enums and Land's enums?
Reply
#9

You can't create a GangZone using only X, Y, Z.I did a little script to give you an idea of how to do it.
I'm sorry if there are a few mistakes, kinda wrote it in a hurry.
PHP код:
#define MAX_LANDS 100 //Maximum number of lands
#define INVALID_LAND_ID -1

new playerLand[MAX_PLAYERS]; //Stores the land id of the player


enum lInfo
{
    
Float:lID//Used to store the result of GangZoneCreate
    
Float:lMinX//Needed for gangZone
    
Float:lMinY//Needed for gangZone
    
Float:lMaxX//Needed for gangZone
    
Float:lMaxY//Needed for gangZone
    
lOwner[MAX_PLAYER_NAME], //Owner's name
    
lOwned//Set it to 0 it none owns it, or 1 if someone does
    
lCreated //Set it to 1 if the land exists, or 0 if it doesn't
};
new 
landInfo[MAX_LANDS][sizeof(lInfo)];

public 
OnPlayerConnect(playerid)
{
    
playerLand[playerid] = INVALID_LAND_ID;
    return 
1;
}

stock getFreeLandID()
{
    for(
int i 0MAX_LANDSi++)
        if(!
landInfo[i][lCreated])
            return 
i;
    return 
INVALID_LAND_ID;
}

/*
You will need minX, minY, maxX, maxY coords to create a gangzone.A gangzone doesn't care about Z.
*/
stock createLand(playeridFloat:minXFloat:minYFloat:maxXFloat:maxY//Function used by admins to create the land
{
    new 
landID getFeeLandID(); //Store a free land ID
    
if(landID != INVALID_LAND_ID)
    {
        
landInfo[landID][lMinX] = minX;
        
landInfo[landID][lMinY] = minY;
        
landInfo[landID][lMaxX] = maxX;
        
landInfo[landID][lMaxY] = maxY;
        
strcpy(landInfo[landID][lOwner], "No-one");
        
landInfo[landID][lOwned] = 0;
        
landInfo[landID][lCreated] = 1;
        
landInfo[landID][lID] = GangZoneCreate(minXminYmaxXmaxY); //Same as: GangZoneCreate(landInfo[landID][lMinX], landInfo[landID][lMinY], landInfo[landID][lMaxX] = maxX, landInfo[landID][lMaxY] = maxY);
        
GangZoneShowForAll(landInfo[landID][lID], 0xFFFFFF93); //0xFFFFFF93 can be replaced with any color.
        //Send message that a land has been created
    
}
    else
        
SendClientMessage(playerid0xFFFFFFFF"All the land zones are used.");
}

//returns the landID a specific player is inside of or INALID_LAND_ID if the player isn't inside any land
stock getPlayerLandID(playerid)
{
    for(
int i 0MAX_LANDSi++)
        if(
landInfo[i][lCreated])
            if(
IsPlayerInArea(playeridlandInfo[i][lMinX], landInfo[i][lMinY], landInfo[i][lMaxX], landInfo[i][lMaxY]))
                return 
i;
    return 
INVALID_LAND_ID;
}

stock isPlayerInOwnLand(playerid)
{
    if(
playerLand[playerid] != INVALID_LAND_ID//Checks if the player owns any land
    
{
        new 
landID playerLand[playerid]; //Store the land ID
        
if(landInfo[landID][lCreated]) //Checks to see if the land exists
            
if(IsPlayerInArea(playeridlandInfo[landID][lMinX], landInfo[landID][lMinY], landInfo[landID][lMaxX], landInfo[landID][lMaxY])) //Check to see if player is in his own land
                
return 1;
    }
    return 
0;
}

stock onLandBought(playeridlandID)
{
    new 
playerName[MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayerNamesizeof(playerName));
    
//
    
playerLand[playerid] = landID;
    
//Update the land info
    
landInfo[landID][lOwned] = 1;
    
strcpy(landInfo[landID][lOwner], playerName);
}

CMD:buyland(playeridparams[])
{
    new 
landID getPlayerLandID(playerid);
    if(
landID != INVALID_LAND_ID)
    {
        
//Your code
        
onLandBought(playeridlandID);
    }
    else
        
SendClientMessage(playerid0xFFFFFFFF"Message to let him know he's not in any zone.");
    return 
1;
}

//Cmd for admins
CMD:createland(playeridparams[])
{
    if(
IsPlayerAdmin(playerid))
    {
        new 
Float:minXFloat:minYFloat:maxXFloat:maxY;
        if(
sscanf(params"ffff"minXminYmaxXmaxY))
            return 
SCM(playerid0xFFFFFFFF"/createland [minX] [minY] [maxX] [maxY]");
        
createLand(playeridminXminYmaxXmaxY;
        return 
1;
    }
    return 
0;
}


//Useful functions
stock strcpy(dest[], const source[], maxlength=sizeof dest)
{
    
strcat((dest[0] = EOSdest), sourcemaxlength);
}

/*
We'll use this function to see if playerid is inside a land
*/
public IsPlayerInArea(playeridFloat:minx2Float:miny2Float:maxx2Float:maxy2)
{
    new 
Float:xaFloat:yaFloat:za;
    
GetPlayerPos(playeridxayaza);
    if (
xa minx2 && xa maxx2 && ya miny2 && ya maxy2) return 1;
    return 
0;

Reply
#10

Quote:

You can't create a GangZone using only X, Y, Z.I did a little script to give you an idea of how to do it.
I'm sorry if there are a few mistakes, kinda wrote it in a hurry.

That's a useful code, but what to do to make the MinX and MinY and MaxX and MaxY be automatically set at the admin's pos. When he does /createland, although i guess the cmd of /buyland which you've created is working when a person is standing in the place of his own land? Ahh, and to make the land invisible from the land o just want an icon to appear infront of the character, should i remove the
Quote:

GangZoneShowForAll

and put
Quote:

CreateDynamicPickup

and an automated textdraw? Just like houses and business system of rp servers?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)