SA-MP Forums Archive
[Include] [INC]Property-System [V 1.6.8] =>Update 2nd of April 2008<= - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] [INC]Property-System [V 1.6.8] =>Update 2nd of April 2008<= (/showthread.php?tid=31653)

Pages: 1 2 3 4


[INC]Property-System [V 1.6.8] =>Update 2nd of April 2008<= - Sandra18[NL] - 25.03.2008

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] [V 1.5]
Код:
new Hotel;
Hotel = AddProperty("Royal Hotel", 3.2, 523.1, 900.0, 4000, 321, 51);

[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
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);
- 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: 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:
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<=


Re: [INC]Property-System <<Easy To Use Properties>> - Exuro - 25.03.2008

Another great include from the master!


Re: [INC]Property-System <<Easy To Use Properties>> - FarePak - 25.03.2008

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


Re: [INC]Property-System <<Easy To Use Properties>> - snipe69 - 25.03.2008

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?


Re: [INC]Property-System <<Easy To Use Properties>> - FarePak - 25.03.2008

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 ...


Re: [INC]Property-System <<Easy To Use Properties>> - blewert - 25.03.2008



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



Re: [INC]Property-System <<Easy To Use Properties>> - Sandra18[NL] - 25.03.2008

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




Re: [INC]Property-System <<Easy To Use Properties>> - Zero_MC - 25.03.2008

Another great & amazing INC, your great Sandrita ^^ good work ^^


Re: [INC]Property-System <<Easy To Use Properties>> - Donny_k - 25.03.2008

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.


Re: [INC]Property-System <<Easy To Use Properties>> - The_Hunter - 25.03.2008

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?


Re: [INC]Property-System <<Easy To Use Properties>> - sebihunter - 25.03.2008

@Hunter
I think so

@Sandra

Really nice include!


Re: [INC]Property-System <<Easy To Use Properties>> - El0vric - 25.03.2008

Really nice work, keep up the good work.


Re: [INC]Property-System <<Easy To Use Properties>> - The_Hunter - 25.03.2008

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


Re: [INC]Property-System <<Easy To Use Properties>> - El0vric - 25.03.2008

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.


Re: [INC]Property-System <<Easy To Use Properties>> - Sandra18[NL] - 25.03.2008

Ok, i will try to rewrite this include

Thanks for the tips :P


Re: [INC]Property-System <<Easy To Use Properties>> - Antironix - 25.03.2008

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*




Re: [INC]Property-System [V 1.5] <<Easy To Use Properties>> - Sandra18[NL] - 25.03.2008

New Version:

[V 1.5]
Код:
new Hotel;
Hotel = AddProperty("Royal Hotel", 3.2, 523.1, 900.0, 4000, 321, 51);



Re: [INC]Property-System [V 1.5] <<Easy To Use Properties>> - Maikel - 25.03.2008

Niceeee


Re: [INC]Property-System [V 1.5] <<Easy To Use Properties>> - Amit_B - 25.03.2008

Good job!


Re: [INC]Property-System [V 1.5] <<Easy To Use Properties>> - [IB]Scorcher - 25.03.2008

Sandra!,thanks again for creating this stuff