[FilterScript] [2013]Sasinosoft Houses 2.0 - Houses, Stores, Furniture...
#1

Sasinosoft Houses 2.2
House, store and furniture system
Hello SA-MP community, after months of scripting nothing for SA-MP, I'm very happy to show you my newest filterscript, Sasinosoft Houses 2. , the second version of my Sasinosoft Houses filterscript.
I started to create this version from scratch, I didn't edit the version 1, and I started it about the 15~20 december.
Today, the 09/01/2013 I fixed a bug, in the new new zip file you can see a file containing the changes.
Today, the 24/01/2013 I fixed another bug. The owner of a store wasn't able to sell his store. I don't know why didn't I notice it first.

Description

It's different from all the other house/business system, this has some unique features that I didn't find before in any other released house/business filterscript:
- Integrated furniture system (buy, sell, edit position and rotation...)
- House visiting before buying (by default 60 seconds, but it can be changed with a define)
- Making store item lists that can be handled in the gamemode with a callback
- All in list dialogs, no commands like /buyhouse etc..
- 2 in 1, this system is houses + stores.

Then there are some other facts:
- Using Incognito's Streamer plugin for the furniture
- Using SII (Slick's Ini Include) for saving data
- 1540~ lines
- 1 line = one house
- 1 line* = one store/shop/business (call it what you want, I really don't know what's the most appropriate word)
- Stores have a "goods" system, when they finish the owner should buy them.
- Stores have a "cash register system", when a player buys something in a store his money goes there. You can also set a store to make the players pay at entrance.
- Works with no text commands**, there's only 1 key (that can be redefined) which opens all the menus.
- The owner of a house can lock, unlock, enter and sell his house. (note: if his house is locked he still can enter it, but other people can't)
- The owner of a store can lock (same as above), unlock, enter, sell, refill, collect money from cash register. He can also buy an item from his own store and get back his money again by collecting them from cash register.
- I forgot to say that the house owner when inside in his house he can store money, withdraw money, store weapons, collect weapons, buy furniture, sell furniture and place/edit furniture.
- When an user sells a house, a store or a furniture, the initial value will be multiplied by a value (that you can define in the source script) and the server will give him back that money. (default is 0.8 )
- You can add, change or remove furnitures from the script very easily.

* if you want to add an item list to a store you should handle a callback to respond.
** There are 2 text commands (only for RCon logged admins), /savehouse and /savestore, which allow you to save to a text file the coordinates of your current position in CreateHouse or CreateBusiness format instead of using SA-MP's /save command that saves them in AddPlayerClass format.

Setup
Unfortunately to set up this filterscript is a bit of work, but if you follow these steps it won't be hard
  • Download the rar package
  • Extract it on your desktop
  • Move SasinosoftHouses_2.2.amx and .pwn to your server's filterscript directory
  • If you already didn't, download Slick's Ini Include from here https://sampforum.blast.hk/showthread.php?tid=58458 and put it in your include folder
  • Open SII.inc and change INI_MAX_LINES from 256 to 512. (House files are a little big lol)
  • If you already didn't, download Incognito's Streamer Plugin from here https://sampforum.blast.hk/showthread.php?tid=102865 and follow its instructions to install it.
  • Make sure that in the scriptfiles folder exists the folder "Sasinosoft", and into it the 2 folders "Houses" and "Shops".
  • Open your server.cfg and add the filterscript to the filterscripts line.
  • Optional: copy example.amx and .pwn to your gamemode and run it to see how it works
  • Open SasinosoftHouses.pwn and you will notice a huge comment, in it there's this "PLACE THIS IN YOUR GAMEMODE:", copy all the code under it and paste it in your gamemode. If you don't want to create your houses and stores in your gamemode, you can also edit the filterscript and create them in it.
  • Change the defines and the furniture list as you wish.
  • Go to your gamemode again and start creating Houses and Businesses ! I created example.pwn mainly to show you how to use it, check it out !
Screenshots
I made a lot of screenshots. The gamemode running is example.pwn provided in the zip file.

http://imageshack.us/a/img266/8800/samp853.png
http://imageshack.us/a/img99/2731/samp854.png
http://imageshack.us/a/img600/3493/samp855g.png
http://imageshack.us/a/img526/6407/samp856b.png
http://imageshack.us/a/img842/9427/samp857on.png
http://imageshack.us/a/img560/1424/samp858q.png
http://imageshack.us/a/img837/1558/samp859z.png
http://imageshack.us/a/img341/5875/samp860o.png
http://imageshack.us/a/img99/6758/samp861y.png
http://imageshack.us/a/img853/2348/samp862d.png
http://imageshack.us/a/img542/5972/samp863e.png
http://imageshack.us/a/img21/2818/samp864f.png
http://imageshack.us/a/img6/589/samp865kx.png
http://imageshack.us/a/img20/2778/samp866hw.png
http://imageshack.us/a/img546/2973/samp867z.png

How to add a house

It's very simple:
  • Connect to your server (with Sasinosoft Houses loaded)
  • Login into rcon
  • Go near a house door
  • Write the command /savehouse [description], I suggest to be specific when writing the description if you are going to save a lot of houses
  • Quit the server
  • Go to scriptfiles/Sasinosoft/Houses
  • There should be a file called SavedHouses.txt
  • Cut all his content and paste it under your OnGameModeInit
  • Search for house interiors (Useful links: https://sampwiki.blast.hk/wiki/InteriorIDs#Burglary_Houses https://sampforum.blast.hk/showthread.php?tid=71648)
  • Insert the other parameters
  • Done
How to add a store
  • Connect to your server (with Sasinosoft Houses loaded)
  • Login into rcon
  • Go near a storee door
  • Write the command /savestore [description]
  • Quit the server
  • Go to scriptfiles/Sasinosoft/Shops
  • There should be a file called SavedShops.txt
  • Cut all his content and paste it under your OnGameModeInit
  • Search for store interiors (see the links above)
  • Fill the other parameters
  • Optional: Fill the "itemlist" parameter (see below)
How to add an item list to a store
This thing is not simple for all, you must have a little of scripting knowledge to do this:
First of all you have to fill the itemlist parameter in a store, the items are separed by a \n character. Example: "Item name 1 (price$)\nItem name 2 (price$)\nItem name 3 (price$)"...
Then you have to create a global variable to store the storeid. Example: biz1 = CreateBusiness(...);
At the end, go to your callback called OnPlayerBuyItem and write:
pawn Code:
public OnPlayerBuyItem(playerid, shopid, itemid)
{
    if(shopid == store1_variable)
    {
        switch(itemid)
        {
            case 0: // Bought the first item in your list
            {
                new price = 20; // Write the price
                new string[64];
                if(GetPlayerMoney(playerid) < price) return MsgBox(playerid, BOX_STYLE_ERROR, NO_MONEY); // Rember to make these checks
                if(!GiveBusinessGoods(shopid, -2)) return MsgBox(playerid, BOX_STYLE_ERROR, NO_STOCK); // You can change the number of goods an item requires, for example you can make that a pistol takes 2 goods, but a shotgun takes 4 etc...
                GivePlayerMoney(playerid, -price); // Remember to subtract player's money
                GiveBusinessMoney(shopid, price); // Remember to add money to the cash register
                format(string, 64, "You bought a **** for %d$", price); // At the place of *** write the thing that the player just bought
                MsgBox(playerid, BOX_STYLE_CMD, string);
                // THEN HERE DO WHAT YOU WANT :)
                // Example:
                GivePlayerWeapon(playerid, 28, 300);
                // Or
                SetPVarInt(playerid, "Cellphone", 1);
                // Or
                ApplyAnimation(playerid, "FOOD", "EAT_Pizza", 2.0, false, true, true, true, 3000, true);
                // You can do what you want :)
            }
            case 1:
            {
                // .....
            }
        }
    }
    else if(shopid == store2_variable)
    {
    }
    return 1;
}
Download
New: 2.2
To download the whole .zip archive click the link below
http://www.2shared.com/file/e-H2vd_0...ouses_22.html?
(Link updated: readded example.pwn and .amx, because when I switched to 2.2 I forgot them)

If you wish to see the code on pastebin click this other link (2.2)
http://pastebin.com/PABSEj5W

Common mistakes

Issue 1: When I select a list item in any dialog nothing happens
Solution 1: Make sure that in your gamemode and in all your loaded filterscripts OnDialogResponse (if exists) returns 0 (Recommended)
Solution 2: Move SasinosoftHouses_2.2 before all the other filterscripts in server.cfg (Not recommended because the other filterscripts that use dialogs won't work)
Issue 2: Furniture are getting saved only up to ID 31
Solution 1: Open your SII.inc and change MAX_INI_LINES to a bigger value (512 recommended), then open Sasinosoft Houses and recompile.
Solution 2: Open Sasinosoft Houses source file and decrease MAX_FURNITURE to 30.
If you have other problems ask in the comments, I'll put here your issue and the possible solutions

For the next version...
I could add a lot of new features for the next version (3.0), I was thinking things like house & store robbery system, housecar system, predefined interiors (so you don't have to search them on the sa-mp wiki), making a simpler way to respond to item clicks, and as many of you suggested, a dynamic creating system, so an admin can create houses from the server.
If you have more ideas please write them

Support me
If you want to support me for my work, you can buy me a coffee.
Reply
#2

1st comment , Good Job
Reply
#3

Quote:
Originally Posted by nor15
View Post
1st comment , Good Job
Thanks
Reply
#4

Looks uber awesome... Except I still prefer at least one command, like /house to open the dialog. It's more than pain in the ass when you walk near a door and the stupid dialog pops out lol. Also you should be abled to enter with just pressing 'F'.
Reply
#5

Great. But i can't use it anymore.
My gamemode is attach to GarHouse i mean. I've it as a gamemode (inside my gamemode)
Reply
#6

WoW really nice
Reply
#7

Nice Job, pretty amazing, +rep
Reply
#8

Nice job [GF]Sasino97.
Reply
#9

Good Job, +rep
Reply
#10

Greeat , all that is needed is so you can rob stores and houses .. so i can remove my stores heh
Reply
#11

Nice, nice! Only I do not like the icons on the radar.
Reply
#12

Nice work dude.
Can you explain me how to add house or store ??
Reply
#13

Wow, this look cool I'm going to try it and I'll come back and tell you what I think and if you need to add something. I never get bored of new house systems. Maybe this will be my last unless you make it better
Reply
#14

Quote:
Originally Posted by mikjo
Посмотреть сообщение
Nice work dude.
Can you explain me how to add house or store ??
did you do everything from the instructions from the pawn file? if yes all you do is once you saved a house go to the houses in the notepad and add them under gamemodeinit. it should work fine.
ill leave you a house here that i created, its ryders house. also for virtualworld you want to add a new world so people never run into each other when they have a house with the same interior. Its Ryders House in Ganton

Before:
CreateHouse(2459.48, -1690.52, 13.54, interiorX, interiorY, interiorZ, price, interior, 0, virtualworld); //

After:
CreateHouse(2459.48, -1690.52, 13.54, 223.043991, 1289.259888, 1082.199951, 280000, 1, 0, 1); //Ryders House
Reply
#15

Thanks you all !

Quote:
Originally Posted by Wax'
Посмотреть сообщение
Nice, nice! Only I do not like the icons on the radar.
You can disable them, look MAP_ICONS definition, you can set it to 0.

Quote:
Originally Posted by mikjo
Посмотреть сообщение
Nice work dude.
Can you explain me how to add house or store ??
First go in your server, go near the door of a house and select /savehouse, do so also for stores and do /savestore or /savebiz.
When you quit, go in your scriptfiles folder and in the folder Sasinosoft/Houses and /Shops there should be one file in each of them. The 2 files contain the houses and stores you saved, copy them in your game mode, and search on internet for house interior coordinates. I'm thinking also to add default interiors in version 3.0, so the people don't have to search on the internet for coordinates.
For stores, it's a bit more complicate, because after adding them you may want to add an item menu, and then you should use the callback to do something, for example giving the user a weapon or health or setting a pvar etc...
I added more information to the thread
Quote:
Originally Posted by Da' J'
Посмотреть сообщение
Looks uber awesome... Except I still prefer at least one command, like /house to open the dialog. It's more than pain in the ass when you walk near a door and the stupid dialog pops out lol. Also you should be abled to enter with just pressing 'F'.
There's a key to press to open the menu, default is Submission key, but you can change it:
pawn Код:
#define KEY KEY_LOOK_BEHIND // The key to press to open dialogs
#define KEY_STRING "\"MMB\"" // The same, but in a string
pawn Код:
#define KEY KEY_SECONDARY_ATTACK
#define KEY_STRING "\"Enter\""
I avoided to set Enter as default because if a vehicle is near there the player enters it.
Reply
#16

Epic work! one of the bestest house system! +6 reps!
Reply
#17

Awesome! Rep+
Reply
#18

OMFG !! One of very, very GOOD filterscript created on this forum.

Awesome job ! Rep+ !
Reply
#19

Quote:
Originally Posted by XtremeR
Посмотреть сообщение
Epic work! one of the bestest house system! +6 reps!
Quote:
Originally Posted by okil
Посмотреть сообщение
Awesome! Rep+
Quote:
Originally Posted by Edvin
Посмотреть сообщение
OMFG !! One of very, very GOOD filterscript created on this forum.

Awesome job ! Rep+ !
Thank you all !!
Reply
#20

One thing, when I pressed Buy Furniture nothing happens, what's going on?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)