25.03.2008, 01:10
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
- 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

- 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
How to instal:
- Download properties.inc and copy that file into your pawno/includes folder
- Add on top of you Gamemode:
Код:
#include <properties>
Код:
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
Код:
ResetPlayerPropertyInfo(playerid);
Код:
OnPropertyPickupPickup(playerid, pickupid);
Therefor you need this:
Код:
if (strcmp("/buyproperty", cmdtext, true) == 0) { BuyPropertyForPlayer(playerid); return 1; } if (strcmp("/sellproperty", cmdtext, true) == 0) { SellPropertyForPlayer(playerid); return 1; }
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);
Код:
SetPayoutFrequency(seconds);
Код:
UsePropertyTextDraw(1);
(See screenshots below)
Other Functions:
You can locate a property if you use the function:
Код:
LocatePropertyForPlayer(property, playerid);
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);
Код:
GetPropertyInfo(propertyID, &Float:X, &Float:Y, &Float:Z, &Price, &SellValue, &Earning);
Код:
GetPropertyName(propertyID);
Код:
GetPropertyOwner(propertyID);
If the property is not owned, it will return "nobody"
Код:
GetPropertyStatus(propertyID);
Else if the property is disabled, this function will return "disabled"
Код:
ToggleProperty(propertyID, toggle);
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();
Код:
SetPropertyPrice(propertyID, price);
Код:
SetPropertySellValue(propertyID, value);
Код:
SetPropertyEarning(propertyID, earning);
Код:
DoesPropertyExists(propertyID);
Код:
IsPlayerNearProperty(playerid);
it will retrurn '-1' the player is not near a property
Код:
SaveProperty(propertyID, const 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) |
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; }
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 |
- 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]
- 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<=