SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 15/09/2011, 10:25 AM   #1
PowerPC603
High-roller
 
Join Date: Nov 2010
Location: Belgium
Posts: 1,733
Reputation: 238
Default PPC_Housing

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.
http://forum.sa-mp.com/showthread.php?t=102865
It also uses sscanf:
http://forum.sa-mp.com/showthread.php?t=120356
And zcmd is also required:
http://forum.sa-mp.com/showthread.php?t=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
__________________
Gamemode: PPC_Trucking
Extras-file (for PPC_Trucking): /delproperty, /evict, /propertyid, /porthouse, /portbus, /properties
------------------------------------------------------------------------------------
PPC-Trucking-V2 (home-hosted, only open on occasion for testing purposes): ppctruckingv2.no-ip.info:7777
Youtube channel: https://www.youtube.com/channel/UC-4...Mpglma8f0Ld-YQ
------------------------------------------------------------------------------------
Filterscripts: PPC_Speedometer - PPC_Housing - PPC_Business

Last edited by PowerPC603; 31/01/2014 at 07:21 AM.
PowerPC603 is offline   Reply With Quote
Old 15/09/2011, 11:03 AM   #2
Speed
Huge Clucker
 
Join Date: Jan 2011
Posts: 206
Reputation: 7
Default Re: PPC_Housing

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


but this is for sure awesome work
Speed is offline   Reply With Quote
Old 15/09/2011, 11:12 AM   #3
[LHT]Bally
Gangsta
 
[LHT]Bally's Avatar
 
Join Date: Aug 2011
Posts: 586
Reputation: 3
Default Re: PPC_Housing

this is better than garhouse imo
[LHT]Bally is offline   Reply With Quote
Old 15/09/2011, 11:14 AM   #4
[LHT]Bally
Gangsta
 
[LHT]Bally's Avatar
 
Join Date: Aug 2011
Posts: 586
Reputation: 3
Default Re: PPC_Housing

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
[LHT]Bally is offline   Reply With Quote
Old 15/09/2011, 11:48 AM   #5
Surferdude
Big Clucker
 
Join Date: Jun 2010
Posts: 77
Reputation: 4
Default Re: PPC_Housing

AWESOME!
__________________
Surferdude is offline   Reply With Quote
Old 15/09/2011, 11:51 AM   #6
Xx_OutLawZ_xX
Big Clucker
 
Join Date: Jul 2010
Posts: 89
Reputation: 12
Default Re: PPC_Housing

Nice system!
Xx_OutLawZ_xX is offline   Reply With Quote
Old 15/09/2011, 11:55 AM   #7
wouter0100
Big Clucker
 
wouter0100's Avatar
 
Join Date: Aug 2010
Posts: 164
Reputation: 0
Default Re: PPC_Housing

Good job,
wouter0100 is offline   Reply With Quote
Old 15/09/2011, 12:16 PM   #8
Manuel7284
Huge Clucker
 
Manuel7284's Avatar
 
Join Date: Dec 2010
Posts: 364
Reputation: 3
Default Respuesta: PPC_Housing

Good!
__________________
Dueño de Guerra de Pandillas
Manuel7284 is offline   Reply With Quote
Old 15/09/2011, 02:20 PM   #9
[LHT]Bally
Gangsta
 
[LHT]Bally's Avatar
 
Join Date: Aug 2011
Posts: 586
Reputation: 3
Default Re: PPC_Housing

my server restarts when i try to createhouse :S
[LHT]Bally is offline   Reply With Quote
Old 15/09/2011, 09:04 PM   #10
PowerPC603
High-roller
 
Join Date: Nov 2010
Location: Belgium
Posts: 1,733
Reputation: 238
Default Re: PPC_Housing

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.
__________________
Gamemode: PPC_Trucking
Extras-file (for PPC_Trucking): /delproperty, /evict, /propertyid, /porthouse, /portbus, /properties
------------------------------------------------------------------------------------
PPC-Trucking-V2 (home-hosted, only open on occasion for testing purposes): ppctruckingv2.no-ip.info:7777
Youtube channel: https://www.youtube.com/channel/UC-4...Mpglma8f0Ld-YQ
------------------------------------------------------------------------------------
Filterscripts: PPC_Speedometer - PPC_Housing - PPC_Business

Last edited by PowerPC603; 15/09/2011 at 11:15 PM.
PowerPC603 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 12:30 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.