SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 20/07/2016, 09:24 PM   #1
JasonRiggs
Huge Clucker
 
Join Date: Jul 2016
Location: My bedroom.
Posts: 255
Reputation: 4
Default Land System

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..
JasonRiggs is offline   Reply With Quote
Old 20/07/2016, 10:16 PM   #2
Codeah
Big Clucker
 
Join Date: Jun 2016
Location: The Netherlands
Posts: 79
Reputation: 45
Default Re: Land System

Please give us more information on what to help you with.
__________________
Check out my website SampListing.com
Codeah is offline   Reply With Quote
Old 19/05/2017, 12:53 AM   #3
JasonRiggs
Huge Clucker
 
Join Date: Jul 2016
Location: My bedroom.
Posts: 255
Reputation: 4
Default Re: Land System

Quote:
Originally Posted by Codeah View Post
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.
JasonRiggs is offline   Reply With Quote
Old 19/05/2017, 01:07 PM   #4
rockhopper
Gangsta
 
rockhopper's Avatar
 
Join Date: Apr 2014
Location: In A Black Hole Under You !
Posts: 614
Reputation: 33
Default Re: Land System

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 : http://forum.sa-mp.com/showthread.php?t=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.
__________________
I love it <3 <3 <3
rockhopper is offline   Reply With Quote
Old 19/05/2017, 02:31 PM   #5
JasonRiggs
Huge Clucker
 
Join Date: Jul 2016
Location: My bedroom.
Posts: 255
Reputation: 4
Default Re: Land System

Quote:
Originally Posted by rockhopper View Post
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 : http://forum.sa-mp.com/showthread.php?t=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..
JasonRiggs is offline   Reply With Quote
Old 19/05/2017, 04:35 PM   #6
GTLS
Huge Clucker
 
GTLS's Avatar
 
Join Date: Aug 2014
Location: GetPlayerPos(GTLS, Float:x, Float:y, Float:Z);
Posts: 360
Reputation: 38
Default Re: Land System

There have been many posts like this on the forums. i dont play on Lawless but i can tell by watching their video on Youtube 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.
__________________
I Dont make Rules..
Quote:
Originally Posted by God
You scare me sometimes, GTLS.
GTLS is offline   Reply With Quote
Old 19/05/2017, 04:46 PM   #7
JasonRiggs
Huge Clucker
 
Join Date: Jul 2016
Location: My bedroom.
Posts: 255
Reputation: 4
Default Re: Land System

Quote:
Originally Posted by GTLS View Post
There have been many posts like this on the forums. i dont play on Lawless but i can tell by watching their video on Youtube 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?
JasonRiggs is offline   Reply With Quote
Old 19/05/2017, 04:48 PM   #8
JasonRiggs
Huge Clucker
 
Join Date: Jul 2016
Location: My bedroom.
Posts: 255
Reputation: 4
Default Re: Land System

What also should I define and add to player's enums and Land's enums?
JasonRiggs is offline   Reply With Quote
Old 19/05/2017, 05:29 PM   #9
Aly
Huge Clucker
 
Join Date: Oct 2012
Posts: 227
Reputation: 11
Default Re: Land System

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 Code:
#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;

Aly is offline   Reply With Quote
Old 19/05/2017, 06:08 PM   #10
JasonRiggs
Huge Clucker
 
Join Date: Jul 2016
Location: My bedroom.
Posts: 255
Reputation: 4
Default Re: Land System

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?
JasonRiggs is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
(Help) Land System CrazyRussainHacker Scripting Help 2 24/02/2015 12:25 AM
Land System [SAMP 0.3z] TheScripterz Scripting Help 3 11/11/2014 01:25 PM
Land System? ChristianIvann09 Scripting Help 0 16/03/2014 02:51 AM


All times are GMT. The time now is 07:37 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.