[FilterScript] [FS] C-House - Load, and Save houses through MySQL. Quick and Easy!
#1

- Hello everyone, i've been working on this system for a while now, and I think it's ready to be released now. The house system, loads and saves houses through MySQL. The house system also has a house ownership system.

Features
- Threaded querys for faster and more stable loading.
- 1 line one house structure!
- House locking system.
- Build up to 2000 houses, in a few minutes.

Information
- This information is in the top of the script.
pawn Код:
/*
*  @title C-House
*  @description - Build in the script /w MySQL loading.
*  @author Carlton
*
*  - This script is downloadable at the SA-MP forums.
*  - Selling this script or re-releasing it without my permission is not allowed
*
*  <-- Install guide -->
*  - Insert your D.B. info into the defines.
*  - Click compile.
*
*  <-- House adding -->
*  - Use the AddServerHouse function.
*
*  <--  Functions -->
*  - AddServerHouse(id, Float:X, Float:Y, Float:Z, Interior, Float:ExitX, Float:ExitY, Float:ExitZ, Price);
*
    + id - The house ID, don't duplicate house ids.
*  + Float:X - The X coordinate. >
*  + Float:Y - The Y coordinate. >> Entrance
*  + Float:Z - The Z coordinate. >
*  + Interior - The interior id for the house.
*  + Float:ExitX - The X coordinate. >
*  + Float:ExitY - The Y coordinate. >> Exit location
*  + Float:ExitZ - The Z coordinate. >
*  + Price - The price of the house.
*
*  - SaveHouse(houseid)
*  + houseid - The house id you wan't save.

*  <-- Support -- >
*  Enjoy the house system, post any questions in the topic.
*/
Example
- I've given you a example in the script.
pawn Код:
AddServerHouse(1, 1984.19,-1995.43,16.3322, 9, 315.856170,1024.496459,1949.797363, 9000);
Put all AddServerHouse functions in OnFilterScriptInit. Also, don't use id 0, I was unable to figure out why phpmyadmin won't let me start off as zero in auto-increment.

Commands
/enter - Enters the house.
/exit - Exits the house.
/housecommands - View the house commands.
/lockhouse - Locks the house if you own it.
/unlockhouse - Unlocks the house if you own it.
/changehouseprice - This is for rcon admins only. This changes the house price.
/buyhouse - Buy the house.
/sellhouse - Sell the house. If you own it.

Installation Information
- Make sure you change these settings so you can use the system.
pawn Код:
#define DB_HOST ""
#define DB_USER ""
#define DB_PASSWORD ""
#define DB_NAME ""
#define DB_TABLE_NAME "Houses"
I really suggest you keep DB_TABLE_NAME as Houses.

Table Structure
- Insert this table structure into your database manager.
Код:
CREATE TABLE IF NOT EXISTS `Houses` (
 `HouseID` int(11) NOT NULL auto_increment,
 `X` float NOT NULL,
 `Y` float NOT NULL,
 `Z` float NOT NULL,
 `Interior` int(11) NOT NULL,
 `ExitX` float NOT NULL,
 `ExitY` float NOT NULL,
 `ExitZ` float NOT NULL,
 `Price` int(11) NOT NULL,
 `Owner` text NOT NULL,
 `Locked` int(11) NOT NULL,
 PRIMARY KEY (`HouseID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
Download
- Enjoy, You also need G-StyleZzZ MySQL plugin to use this.
Reply
#2

Incredible work!!!

Thanks for sharing, I think many people will use this =)
Reply
#3

Thank you.
Reply
#4

Pretty cool.
Reply
#5

Amazing, might use
Thank you.

BTW, this?
Quote:

/buyhouse - Buy the house. If you own it.

Reply
#6

Typo, thanks for telling me PlayON.
Reply
#7

Sounds really good well done.
Reply
#8

Quote:
Originally Posted by V1ceC1ty
Sounds really good well done.
Thanks.
Reply
#9

where can i download G-StyleZzZ MySQL?
Reply
#10

http://forum.sa-mp.com/index.php?action=search
Reply
#11

How can I limit this so each player can own 2 houses?
Reply
#12

Quote:
Originally Posted by [03
Garsino ]
How can I limit this so each player can own 2 houses?
Infinite.
Reply
#13

Quote:
Originally Posted by Carlton
Quote:
Originally Posted by [03
Garsino ]
How can I limit this so each player can own 2 houses?
Infinite.
??

I want each player only be able to own 2 houses nothing more. How can I do that?
Reply
#14

pawn Код:
new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(globalquery, sizeof(globalquery) "SELECT * FROM "DB_TABLE_NAME" WHERE Owner = '%s'", name);
mysql_query(globalquery);
if(mysql_num_rows() >= 2) return GameTextForPlayer(playerid, "You own too many houses!", 5000, 3);
Use that code, in /buyhouse.
Reply
#15

it also has map icons?
Reply
#16

It used to be, but I removed it.
Reply
#17

nICE
Reply
#18

ok im actually looking for a house system like this with map icons
Reply
#19

Just add SetPlayerMapIcon in OnQueryFinish next to CreatePickup
Reply
#20

ok what do you mean with the change the DB_Host things and the database i dont get what your saying
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)