[Include] [INC]Property-System [V 1.6.8] =>Update 2nd of April 2008<=
#1

Property System
+PropertyCreator
+Example Filterscript
What is it:
With this filterscript you can add properties to your server very easy
You only need 1 line for 1 property.
You can buy and sell properties, every (default) 60 seconds you will receive an amount of money.

If you want to add houses, including interiors, renting and house-cars.
I recommend you to download Simple House System by Antironix

This Include is not very complex, it's just a simple way to invest and earn money
I made this Include because many people asked if i could make a property-system, so here it is!

Update History:

[V 1.0]
  • First Release
[V 1.5]
  • Removed 'propertyID' param in the AddProperty-function
  • AddProperty returns now it's new ID, so now you can now define properties. (for example:
Код:
new Hotel;
Hotel = AddProperty("Royal Hotel", 3.2, 523.1, 900.0, 4000, 321, 51);
  • Added GetPropertyInfo(propertyID, &Float:X, &Float:Y, &Float:Z, &Price, &SellValue, &Earning);
  • Added GetPropertyName(propertyID);
  • Added GetPropertyOwner(propertyID);
  • Added GetPropertyStatus(propertyID);
  • Added ToggleProperty(propertyID, toggle);

[V 1.6] March 31th 2008/size]
  • Added DestroyAllPropertyPickups();
  • Added UsePropertyTextDraw(toggle);
  • Added Fixed some bugs
[size=10pt][V 1.6.8] (April 2nd 200
  • Added SetPropertyPrice(propertyID, price);
  • Added SetPropertySellValue(propertyID, value);
  • Added SetPropertyEarning(propertyID, earning);
  • Added DoesPropertyExists(propertyID);
  • Added IsPlayerNearProperty(playerid);
  • Added SaveProperty(propertyID, const comment[]);
  • Fixed bug where pickup of first property didn't work
  • Fixed bug where playerid '0' saw all properties instead of only his/hers own when doing /myproperties
  • Released Example Filterscript
Please read this manual very carefully!


How to instal:
- Download properties.inc and copy that file into your pawno/includes folder

- Add on top of you Gamemode:
Код:
#include <properties>
- To add a property, add this at OnGameModeInit (or OnfilterscriptInit() if you're going to use it as a filterscript):
Код:
AddProperty("Name", Float:X, Float:Y, Float:Z, Price, SellValue, Earning);
  • Name: This will be the name of the new property
  • Float:X: This will be the X-coordinate of the property
  • Float:Y: This will be the Y-coordinate of the property
  • Float:Z: This will be the Z-coordinate of the property
  • Value: Players will have to pay this amount to buy this property
  • SellValueL Player will receive this amount of money when he/she sells this property
  • Earning:The owner of this property will receive every 60 seconds (default) this amount of money
- Place at your OnPlayerDisconnect- or OnPlayerConnect-callback this line:
Код:
ResetPlayerPropertyInfo(playerid);
- Place at your OnPlayerPickupPickup-callback this line:
Код:
OnPropertyPickupPickup(playerid, pickupid);
- Now you have to make 2 commands: /buyproperty and /sellproperty
Therefor you need this:
Код:
if (strcmp("/buyproperty", cmdtext, true) == 0)
{
  BuyPropertyForPlayer(playerid);
  return 1;
}
if (strcmp("/sellproperty", cmdtext, true) == 0)
{
  SellPropertyForPlayer(playerid);
  return 1;
}
Ofcourse you have to place these 2 commands in your OnPlayerCommandText-callback.
The BuyPropertyForPlayer-function will already check if the player is near a checkpoint, if he/she has enough money, if he/she doesn't exeed the max-properties-per-player-limit and if the property is not owned yet by someone else or the player him/herself.


Configuration:

To set limit of properties every player can own, use:
Код:
SetMaxPropertiesPerPlayer(amount);
To change the default payout-frequency, use:
Код:
SetPayoutFrequency(seconds);
If you want to see a textdraw showing some info about the property if you pickup its icon, use:
Код:
UsePropertyTextDraw(1);
If you fill in '0' a GameText will apear instead of a textdraw.
(See screenshots below)

Other Functions:

You can locate a property if you use the function:
Код:
LocatePropertyForPlayer(property, playerid);
This will create a checkpoint on the place of the property.
You can disable the checkpoint with the function DisablePlayerCheckpoint(playerid);

To view the properties you own + some info.
You can use this function:
Код:
GetPlayerProperties(playerid);
The function:
Код:
GetPropertyInfo(propertyID, &Float:X, &Float:Y, &Float:Z, &Price, &SellValue, &Earning);
will return the coords, price, sellvalue and earning of that property

Код:
GetPropertyName(propertyID);
will return the name of that property

Код:
GetPropertyOwner(propertyID);
will, if owned return the name of the property-owner
If the property is not owned, it will return "nobody"

Код:
GetPropertyStatus(propertyID);
If the property is enabled, this function will return "enabled"
Else if the property is disabled, this function will return "disabled"

Код:
ToggleProperty(propertyID, toggle);
With this function you can enable or disable a property.
If a property is disabled you are not able to buy that property.
Note: If you disable a property, this green house-icon will not be removed!

Код:
DestroyAllPropertyPickups();
Use this at OnGameModeExit or OnFilterScriptExit, this will destroy all greenhouse icons for the properties.

Код:
SetPropertyPrice(propertyID, price);
Will set a new price of a property.

Код:
SetPropertySellValue(propertyID, value);
Will set a new value of a property.

Код:
SetPropertyEarning(propertyID, earning);
Will set a new earning of a property.

Код:
DoesPropertyExists(propertyID);
will return '1' when the property exists and '0' if it doesn't.

Код:
IsPlayerNearProperty(playerid);
will return the ID of the property if the player is near (default max 3 coords) of a property.
it will retrurn '-1' the player is not near a property

Код:
SaveProperty(propertyID, const comment[]);
This function will save the property with the current price, value and earning + optional comment.
It will get saved in the file 'SavedProperties.txt' witch will get created in your scriptfiles-folder in this format:
Quote:

AddProperty("Current Name", X, Y, Z, current Price, current Value, current Earning); // (optional comment)

You can use this function for example when you changed some info about a property.
After you saved a property, you only have copy/paste that new line into your filterscript or gamemode.
(Don't forget to delete the old line!!)


Example adding Properties:
Код:
public OnGameModeInit()
{
  AddProperty("CJ's Home", 2495.2581, -1686.3400, 13.5139, 50000, 10000, 1000);
  AddProperty("Royal Hotel", 327.7912, -1514.7765, 36.0391, 164000, 50000, 6500);
  AddProperty("SexShop Las Venturas", 2088.5579, 2074.0867, 10.8203, 37500, 6000, 670);
  return 1;
}
PropertyCreator:

This is a little filterscript, including 1 command to create a new property.
How to instal:
- Download PropertyCreator.pwn
- Compile
- Run as filterscript
- Go ingame
- Login as rcon-admin
- Go to position where you want to have your new property located
- Use command: /AddProperty [Name] [Price] [SellValue] [Earning]
For example:
Quote:

/AddProperty Hotel 40000 10000 750

Note: For the name: DO NOT USE SPACES!!. You can add them later!

- Now go to your scriptfiles-folder, there is a file called 'SavedProperties.txt'
- Copy the new lines into your Gamemode
- Compile and restart your gamemode, and properties are ready to get bought

Download links for PropertyCreator:
- PropertyCreator.pwn (MediaFire)
- PropertyCreator.pwn (MyFreefilehosing.com)


Example Filterscript:

This filterscript is ready-to-use, it has some pre-made properties (6 houses in GroveStreet).
It also has example commands:
  • /propertyhelp
  • /buyproperty
  • /sellproperty
  • /myproperties
  • /getpropertyID
  • /locateproperty [ID]
  • /disableCP
  • /propertyinfo [ID]
  • RconAdmin-commands:
  • /SetPropertyPrice [ID] [Price]
  • /SetPropertyValue [ID] [Value]
  • /SetPropertyEarning [ID] [Earning]
  • /disableproperty [ID]
  • /enableproperty [ID]
  • /saveproperty [optional comment]
Download links for Example Filterscript:
- Properties.pwn (MediaFire)
- Properties.pwn (MyFreefilehosing.com)

Screenshots:


On the left you see a textdraw witch gets created when the player enters the green housepickup


If you decide to use GameText instead of Textdraw, it will look like this.

Btw: I already fixed the typo you can see in the chat. ("You received $1670 from you properties")


This image shows the menu you will see when you use the function GetPlayerProperties(playerid);


Download:

[Version 1.6.8] April 2nd
- properties.inc (MediaFire)
- properties.inc (MyFreeFileHosting)

[Version 1.6] (Fixed)
- properties.inc (MediaFire)
- properties.inc (MyFreeFileHosting)

[Version 1.5]
- properties.inc (MediaFire
- properties.inc (myfreefilehosting.com)

[Version 1.0]
- properties.inc (MediaFire)
- properties.inc (SendSpace)
- properties.inc (myfreefilehosting.com)


Credits:
  • Sneaky! - PlayerToPoint-function
  • =>Sandra<= - Rest of this code

Notes:

- Remember: If you disconnect, you will lose your properties!
- Also if you restart your Gamemode, all properties will be reset.
- If you have any suggestions, post them here.
- If you found a bug, please report it in this topic.

I hope you will enjoy my 11th release

Please give comments!
=>Sandra<=
Reply
#2

Another great include from the master!
Reply
#3

Sandra you are awesome, I've been wanting properties for ages but i tried to make my own but all i could get is bugs ;l
Best INC so far i'd say, and the 1st include i ever installed :]
Reply
#4

you never stop scripting lol always release awesome scripts
keep good work
but if i leave server and join again i still have my properties?
Reply
#5

Quote:
Originally Posted by $SnIpE$
you never stop scripting lol always release awesome scripts
keep good work
but if i leave server and join again i still have my properties?
No seeing as there will be a reset ...
Reply
#6



another awesome script! Damn i don't think you can stop can you?
Reply
#7

Thank you all very much!
No, i don't think i will stop scripting soon :P
I enjoy making such scripts.

If you have any suggestions, or ideas for new systems (includes or filterscrips), you can pm me


Quote:
Originally Posted by $SnIpE$
but if i leave server and join again i still have my properties?
No, you will lose your properties if you disconnect, or the gamemode restarts.
Maybe in future versios i will make a saving feature

Reply
#8

Another great & amazing INC, your great Sandrita ^^ good work ^^
Reply
#9

I haven't looked at your code but I would recomend not having the ID in the AddProp function. Use a counter in the actuall function like so:

pawn Код:
new gPropCount = -1,
  Float:gProps[ 20 ][ 5 ] = {.......... //x, y, z, radius, cp size or whatever....


AddProp.....( Float:x, Float:y.............
{
   gPropCount ++;
   gProps[ gPropCount ][ 0 ] = x;
   gProps[ gPropCount ][ 1 ] = y;
   //etc.....
   return gPropCount;
}
You can use the ID like this then:

pawn Код:
new gWangs;

public OnGameModeInit()
{
   gWangs = AddProp....................
}
And check it like this:

pawn Код:
OnPlayerEnterProperty( playerid, propid )
{
   if ( propid == gWangs )
   {.......}
Like I said I was just reading the post and thought it may be an idea for you. Good idea either way, I like all these simple (as in makes things simple for the user) includes.
Reply
#10

Nice work. Little Question though:

Im trying to make an ingame command for admins to create propertys ingame. Does CreateProperty have to be under ongamemodeinit?
Reply
#11

@Hunter
I think so

@Sandra

Really nice include!
Reply
#12

Really nice work, keep up the good work.
Reply
#13

Oh, and another thing, Little Suggestion: Rename your color defines in the include, a lot of scripts already have COLOR_RED defined, Perhaps you could rename them to propCOLOR_RED or somthing
Reply
#14

Quote:
Originally Posted by The_Hunter
Oh, and another thing, Little Suggestion: Rename your color defines in the include, a lot of scripts already have COLOR_RED defined, Perhaps you could rename them to propCOLOR_RED or somthing
Or just use #if defined to check if color is already defined.
Reply
#15

Ok, i will try to rewrite this include

Thanks for the tips :P
Reply
#16

Thanks for the advertisement here! I will do the same for you.

Hmm, i wanted to ask something but it got lost :/.


*I am thinking to upgrade my house script again:P*

Reply
#17

New Version:

[V 1.5]
  • Removed 'propertyID' param in the AddProperty-function
  • AddProperty returns now it's new ID, so now you can now define properties. (for example:
Код:
new Hotel;
Hotel = AddProperty("Royal Hotel", 3.2, 523.1, 900.0, 4000, 321, 51);
  • Added GetPropertyInfo(propertyID, &Float:X, &Float:Y, &Float:Z, &Price, &SellValue, &Earning);
  • Added GetPropertyName(propertyID);
  • Added GetPropertyOwner(propertyID);
  • Added GetPropertyStatus(propertyID);
  • Added ToggleProperty(propertyID, toggle);
Reply
#18

Niceeee
Reply
#19

Good job!
Reply
#20

Sandra!,thanks again for creating this stuff
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)