help with house system
#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 Smiley
I made this Include because many people asked if i could make a property-system, so here it is! Cheesy

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:

Code:

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


[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:
Code:

#include <properties>


- To add a property, add this at OnGameModeInit (or OnfilterscriptInit() if you're going to use it as a filterscript):
Code:

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

ResetPlayerPropertyInfo(playerid);


- Place at your OnPlayerPickupPickup-callback this line:
Code:

OnPropertyPickupPickup(playerid, pickupid);


- Now you have to make 2 commands: /buyproperty and /sellproperty
Therefor you need this:
Code:

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

SetMaxPropertiesPerPlayer(amount);


To change the default payout-frequency, use:
Code:

SetPayoutFrequency(seconds);


If you want to see a textdraw showing some info about the property if you pickup its icon, use:
Code:

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

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

GetPlayerProperties(playerid);


The function:
Code:

GetPropertyInfo(propertyID, &Float:X, &Float:Y, &Float:Z, &Price, &SellValue, &Earning);

will return the coords, price, sellvalue and earning of that property

Code:

GetPropertyName(propertyID);

will return the name of that property

Code:

GetPropertyOwner(propertyID);

will, if owned return the name of the property-owner
If the property is not owned, it will return "nobody"

Code:

GetPropertyStatus(propertyID);

If the property is enabled, this function will return "enabled"
Else if the property is disabled, this function will return "disabled"

Code:

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!

Code:

DestroyAllPropertyPickups();

Use this at OnGameModeExit or OnFilterScriptExit, this will destroy all greenhouse icons for the properties.

Code:

SetPropertyPrice(propertyID, price);

Will set a new price of a property.

Code:

SetPropertySellValue(propertyID, value);

Will set a new value of a property.

Code:

SetPropertyEarning(propertyID, earning);

Will set a new earning of a property.

Code:

DoesPropertyExists(propertyID);

will return '1' when the property exists and '0' if it doesn't.

Code:

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

Code:

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

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 Cheesy

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)






when i tied AddProperty("Name", Float:X, Float:Y, Float:Z, Price, SellValue, Earning);
in my gm and try complie
respond
undefined symbol "X"
Reply
#2

first before i even attempt to try to help do this

pawn Код:
your code
Reply
#3

Код:
AddProperty("Name", Float:X, Float:Y, Float:Z, Price, SellValue, Earning);
All the things must be replaced with your own info like the following:

Код:
AddProperty("House1", 2241.361,-1261.933,23.944432, 5000, 2500,100);
So the name of the house is: House1
Coordinate, where the house is located: 2241.361,-1261.933,23.944432
Price to buy is: 5000
When you sell it you get: 2500
And you get: 100 dollar per hour you are owning the house/property...
Reply
#4

Quote:
Originally Posted by $Fl@Ke$
first before i even attempt to try to help do this

pawn Код:
your code
its my owm gm so never to past code for any one
Reply
#5

Quote:
Originally Posted by Oxside
Код:
AddProperty("Name", Float:X, Float:Y, Float:Z, Price, SellValue, Earning);
All the things must be replaced with your own info like the following:

Код:
AddProperty("House1", 2241.361,-1261.933,23.944432, 5000, 2500,100);
So the name of the house is: House1
Coordinate, where the house is located: 2241.361,-1261.933,23.944432
Price to buy is: 5000
When you sell it you get: 2500
And you get: 100 dollar per hour you are owning the house/property...
thanks man now i understand
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)