[FilterScript] PPC_Housing
#1

I've just completed my revised/updated housing system as a filterscript and it's finally here.

NOTE: Do NOT use this script together with the PPC_Trucking gamemode.
The gamemode has the housing system built-in and both systems will collide with eachother, as they both use the same commands and dialogs.



The system is quite easy to use.
Just install the script in your filterscripts folder and add it to your server.cfg file.

Also add a new folder called "PPC_Housing" in your scriptfiles folder, this is where the houses are saved and loaded.
If you don't have this folder and try to create a house, your server WILL crash.

Also, make sure ALL your other filterscripts and gamemode use "return 0;" under OnDialogResponse.
Otherwise the /housemenu won't work when you select an option from it.



Requirements:

The filterscript uses Incognito's streamer for the pickups and 3DText labels, so you need it for this script to work.
https://sampforum.blast.hk/showthread.php?tid=102865
It also uses sscanf:
https://sampforum.blast.hk/showthread.php?tid=120356
And zcmd is also required:
https://sampforum.blast.hk/showthread.php?tid=91354

If used together with my Speedometer script, both scripts communicate with eachother (you'll need the latest version for this).
Both scripts work separately too, so don't worry if you want to use only one of them.

This housing system has 2 different types of houses:
- normal houses (they work the same way as in my gamemode: PPC_Trucking):
Those houses start at level 1 when you buy them and they will have only 1 carslot.
Players can upgrade their houses to change their interior and to increase the amount of carslots.
Houses can have a maximum level of 10. When you create a house, you can set the maximum level to any value between 1 and 10.

- static houses:
These houses have a fixed interior (you set the interior when you create the house, they use the same interiors as the normal house's levels), so you could also say they have a fixed level. These houses cannot be upgraded.
They also have a fixed amount of carslots that can't be upgraded.
They have all the same features (rename house, open to public, close to public, buy housecars, ...) as normal houses, except for upgrading.


To create a normal (upgradable) house, use the command: /createhouse <price> <max-level (1-10)>
To create a static house, use the command: /createstatichouse <price> <carslots (1-10)> <interior (1-10)>
You can always use the /delhouse command to delete a house that's still for sale, you cannot delete a house that has an owner.

To buy a house, use the /buyhouse command. You need to stand within 2.5m of the entrance (green house-pickup).
To enter your house, stand near your house's entrance and use the command /enter.
To access all house-features, use the /housemenu command.

Exiting the house can also be done through the housemenu.



Car-tunings are also saved in your housefile, so no worries to lose all your vehiclecomponents when you logout.
All vehicles have a price of $50.000, adjust those prices to your needs in the ABuyableVehicles array, which starts at line 188.



Also, there are a few functions that you need to copy and modify to your gamemode or other filterscripts if you use server-sided money.
The filterscript normally has no access to your account-data that your gamemode might hold, but these functions allow the housing script to get data from your gamemode if you copy them to your gamemode.
They are near the bottom of the filterscript.

If you don't copy and edit them, the script will automatically use client-sided money.
pawn Code:
// This function is used to get the player's money
forward EXT_GetPlayerMoney(playerid);
public EXT_GetPlayerMoney(playerid)
{
    return APlayerData[playerid][PlayerMoney];
}

// This function is used to get the player's money
forward EXT_GivePlayerMoney(playerid, Money);
public EXT_GivePlayerMoney(playerid, Money)
{
    // Add the given money to the player's account
    APlayerData[playerid][PlayerMoney] = APlayerData[playerid][PlayerMoney] + Money;

    // Return that the function had success (another script holds the player's money on the server-side)
    return 1;
}

// This function is used to get the player's admin-level
forward EXT_GetPlayerAdminLevel(playerid);
public EXT_GetPlayerAdminLevel(playerid)
{
    return APlayerData[playerid][AdminLevel];
}

// This function is used to determine if the player has logged in (he succesfully entered his password)
forward EXT_IsPlayerLoggedIn(playerid);
public EXT_IsPlayerLoggedIn(playerid)
{
    if (APlayerData[playerid][LoggedIn] == true)
        return 1; // The player has logged in succesfully
    else
        return -1; // The player hasn't logged in (yet)
}
The inner workings of these functions are pretty much self-explanatory.
You might need to edit the location of your data (pData[playerid][Money] for example, instead of APlayerData[playerid][PlayerMoney]).



Screenshot (normal house on the left, static house on the right):


Screenshot (inside the house, showing the housemenu):


Download it here:
http://users.telenet.be/vge/download...PC_Housing.pwn
Reply
#2

nice, but you need something more intersting to beat GarHouse or something else


but this is for sure awesome work
Reply
#3

this is better than garhouse imo
Reply
#4

i get this error ?
pawn Code:
C:\Documents and Settings\BaLLy\Desktop\LONG HAUL TRUCKING\filterscripts\ppchouse.pwn(2997) : error 001: expected token: "*/", but found "-end of file-"
C:\Documents and Settings\BaLLy\Desktop\LONG HAUL TRUCKING\filterscripts\ppchouse.pwn(2997) : warning 203: symbol is never used: "ret_memcpy"
C:\Documents and Settings\BaLLy\Desktop\LONG HAUL TRUCKING\filterscripts\ppchouse.pwn(2997) : warning 203: symbol is never used: "strtok"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase
Reply
#5

AWESOME!
Reply
#6

Nice system!
Reply
#7

Good job,
Reply
#8

Good!
Reply
#9

my server restarts when i try to createhouse :S
Reply
#10

Quote:
Originally Posted by [LHT]Bally
View Post
i get this error ?
pawn Code:
C:\Documents and Settings\BaLLy\Desktop\LONG HAUL TRUCKING\filterscripts\ppchouse.pwn(2997) : error 001: expected token: "*/", but found "-end of file-"
C:\Documents and Settings\BaLLy\Desktop\LONG HAUL TRUCKING\filterscripts\ppchouse.pwn(2997) : warning 203: symbol is never used: "ret_memcpy"
C:\Documents and Settings\BaLLy\Desktop\LONG HAUL TRUCKING\filterscripts\ppchouse.pwn(2997) : warning 203: symbol is never used: "strtok"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase
In the include file "dutils.inc" (normally supplied with samp server package), make both strtok and ret_memcpy a stock function.
Just place "stock" (without the quotes) in front of those functions.
Then they won't be compiled if they're not used, and you won't get those messages.

Another way to fix this:
Copy the function StripNewLine from the include-file "dutils.inc" (supplied by the samp server package) into the filterscript and remove the #include <dutils>
The function StripNewLine is the only function used from that file anyway, no need to include a whole file filled with extra functions that aren't used.



Quote:
Originally Posted by [LHT]Bally
View Post
my server restarts when i try to createhouse :S
Are you sure you've properly installed the required plugins?
Also make sure you've created the PPC_Housing folder in your scriptfiles folder.
If you didn't add that directory, the script can't save the data and will crash your server.
Reply
#11

i have fixed it now lol i failed before
Reply
#12

nice!
edit: i have seen this House System in a lot of servers!but when i asked them what is the name of this house system! they didn\'t tell me!

10/10!!
Reply
#13

Warning error:
Code:
PPC_Housing.pwn(2999) : warning 203: symbol is never used: "ret_memcpy
howto fix this?
Reply
#14

Quote:
Originally Posted by [GTA]AmericanGangster
View Post
Warning error:
Code:
PPC_Housing.pwn(2999) : warning 203: symbol is never used: "ret_memcpy
howto fix this?
Check last post on page 1.



Quote:
Originally Posted by [GTA]AmericanGangster
View Post
nice!
edit: i have seen this House System in a lot of servers!but when i asked them what is the name of this house system! they didn\'t tell me!

10/10!!
That\'s because it didn\'t have a name.

Many servers use my gamemode (PPC_Trucking), the house-system is built-in in that gamemode.

I\'ve just extracted the entire housing-system from the gamemode, updated it (to include static houses), fixed a few minor bugs and created a filterscript out of it.


I\'ll soon be starting a new gamemode and I need my housing system there too. And I don\'t want to implement my entire housing system every time I start a new gamemode.

That\'s why I\'ve created this filterscript.


PS: I can\'t tell much about my new gamemode, as I still don\'t know if I can make it work properly and how it will work out.

But I have the main idea already, but no details yet. I haven\'t started working on it yet, still need to create a few needed filterscripts first. (Admin/register/login FS also needs to come).

But I can tell you it\'s something completely new, I didn\'t see any gamemode using my idea already.
Reply
#15

Thank you but I can\'t use /createhouse .. It says that it\'s an unknown command.. I tried to log in as rcon but nothing is working..


Anyways here is the fix for the 2 warnings if it helped you please rep+

https://sampforum.blast.hk/showthread.php?tid=283679
Reply
#16

Quote:
Originally Posted by Ehab1911
View Post
Thank you but I can\'t use /createhouse .. It says that it\'s an unknown command.. I tried to log in as rcon but nothing is working..


Anyways here is the fix for the 2 warnings if it helped you please rep+

https://sampforum.blast.hk/showthread.php?tid=283679
Logging in as RCON admin should override your adminlevel if you use those external functions.

Even if you don\'t use those functions, it should work properly.

I\'ll try when I get home tonight, gotta go to work now.


But I\'m sure it works, as i don\'t have an admin-script yet and logging in as RCON worked for me.
Reply
#17

Quote:
Originally Posted by [GTA]AmericanGangster
View Post
Warning error:
Code:
PPC_Housing.pwn(2999) : warning 203: symbol is never used: "ret_memcpy
howto fix this?
pawn Code:
#pragma unused ret_memcpy
Reply
#18

NEW VERSION uploaded:


- this fixes the warnings you get with ret_memcpy not being used.


The include "dutils" is gone now, I\'ve just copied the "StripNewLine" function into the script.

So no more warnings about that.




I\'ve also change the names of the external functions to be used in other scripts.

EXT_GivePlayerMoney was a bit confusing, as EXT doesn\'t really indicate in which filterscript the function is located.

Those have been renamed to Admin_GivePlayerMoney for example, as that function will be in my admin script.


So if you used those functions, you can use the new names for them.



I also made a few small optimizations in the script, but nothing to worry about.

Just 2 for-loops have been combined into one.
Reply
#19

ok, I updated but now every command returns Server Unknown Command?
EDIT: fixed, I changed every COMMAND: into dcmd_ but I forgot do remove the #include <zcmd>
anyways, thanks alot man!
this is way better than Garsino's one!
Reply
#20

Don't work i used Gamemode Race/Drift/DM and add PPC_Housing.pwn in filtersciprts and i go in game log in RCON admin and Enter /createhouse It says that it's an unknown command
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)