[FS] C-House - Load, and Save houses through MySQL. Quick and Easy! -
Carlton - 31.03.2010
- 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.
Re: [FS] C-House - Load, and Save houses through MySQL. Quick and Easy! - [03]Garsino - 31.03.2010
Incredible work!!!
Thanks for sharing, I think many people will use this =)
Re: [FS] C-House - Load, and Save houses through MySQL. Quick and Easy! -
Carlton - 31.03.2010
Thank you.
Re: [FS] C-House - Load, and Save houses through MySQL. Quick and Easy! -
Eazy_Efolife - 31.03.2010
Pretty cool.
Re: [FS] C-House - Load, and Save houses through MySQL. Quick and Easy! -
Zh3r0 - 31.03.2010
Amazing, might use

Thank you.
BTW, this?
Quote:
/buyhouse - Buy the house. If you own it.
|
Re: [FS] C-House - Load, and Save houses through MySQL. Quick and Easy! -
Carlton - 31.03.2010
Typo, thanks for telling me PlayON.
Re: [FS] C-House - Load, and Save houses through MySQL. Quick and Easy! -
V1ceC1ty - 31.03.2010
Sounds really good

well done.
Re: [FS] C-House - Load, and Save houses through MySQL. Quick and Easy! -
Carlton - 31.03.2010
Quote:
Originally Posted by V1ceC1ty
Sounds really good  well done.
|
Thanks.
Re: [FS] C-House - Load, and Save houses through MySQL. Quick and Easy! -
Smokey619 - 31.03.2010
where can i download G-StyleZzZ MySQL?
Re: [FS] C-House - Load, and Save houses through MySQL. Quick and Easy! -
Carlton - 31.03.2010
http://forum.sa-mp.com/index.php?action=search
Re: [FS] C-House - Load, and Save houses through MySQL. Quick and Easy! - [03]Garsino - 31.03.2010
How can I limit this so each player can own 2 houses?
Re: [FS] C-House - Load, and Save houses through MySQL. Quick and Easy! -
Carlton - 31.03.2010
Quote:
Originally Posted by [03
Garsino ]
How can I limit this so each player can own 2 houses?
|
Infinite.
Re: [FS] C-House - Load, and Save houses through MySQL. Quick and Easy! - [03]Garsino - 31.03.2010
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?
Re: [FS] C-House - Load, and Save houses through MySQL. Quick and Easy! -
Carlton - 31.03.2010
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.
Re: [FS] C-House - Load, and Save houses through MySQL. Quick and Easy! -
swredder - 31.03.2010
it also has map icons?
Re: [FS] C-House - Load, and Save houses through MySQL. Quick and Easy! -
Carlton - 31.03.2010
It used to be, but I removed it.
Re: [FS] C-House - Load, and Save houses through MySQL. Quick and Easy! -
JPs_ - 31.03.2010
nICE
Re: [FS] C-House - Load, and Save houses through MySQL. Quick and Easy! -
swredder - 31.03.2010
ok

im actually looking for a house system like this with map icons
Re: [FS] C-House - Load, and Save houses through MySQL. Quick and Easy! -
Carlton - 31.03.2010
Just add SetPlayerMapIcon in OnQueryFinish next to CreatePickup
Re: [FS] C-House - Load, and Save houses through MySQL. Quick and Easy! -
Smokey619 - 31.03.2010
ok what do you mean with the change the DB_Host things and the database i dont get what your saying