16.01.2014, 10:19
(
Last edited by Jstylezzz; 10/08/2014 at 11:45 AM.
)
jGarage - Dynamic garages
by Jstylezzz
by Jstylezzz
Introduction
- Why this script?
Hi allInformation
I received some requests for a dynamic garage system, using Dini to save files. After some time of work, I finished it. Now, I know Dini is not the most used and most advanced file processor out here, but as I specifically got asked to use Dini, I used it. Since 5/12/14 there's a universal script available, holding a dini, y_ini, MySQL and SQLite version. It also has 'strcmp command' mode and 'zcmd' mode.
Basically, this script let's you create garages for players to store their vehicles in. Each garage has it's own virtualworld, which means they won't see eachother in different garages. As Rcon, you can create and remove garages. As normal player, you're able to buy a garage, sell your garage, lock it, and store your vehicles in it.
Note: This script does not save vehicles. You'll need a vehicle system which saves the virtualworld and interior of the car, otherwise it won't load properly.
- Things you can configure
If you open the .pwn and scroll down a little, you'll see the config defines. Change them as you wish. Any questions? Just ask below, and I'll happily answer them.pawn Code://====================-- SCRIPT CONFIGURATION --=====================================//
#define COMMAND_SYS 1 //Set to '1' for zcmd, change to '2' for strcmp
#define SAVING_SYS 4//Change this to the number of the saving system you want.
/*
Number System
1 y_ini (y_ini include by ****** needed)
2 Dini (Dini include by Dracoblue needed)
3 MySQL R6 !unthreaded! (MySQL plugin/include by BlueG needed, R6, unthreaded queries)
4 SQLite (sampdb include by the SA-MP Team needed)
*/
//-- SYSTEMATIC CONFIGURATION --//
#define MAX_OWNED_GARAGES 5 //Set this to the max. number of garages that a player should be able to own
#define AUTOSAVE true //Set to false if you don't want the script to autosave
#define AUTOSAVE_INTERVAL 10 //Set this to the amount of <~!~> MINUTES <~!~> you want the autosave function to be called (if enabled)
#define MAX_GARAGES 100 //Max garages to be created in the server
//-- PICKUPS AND TEXTLABELS --//
#define GARAGE_OWNED_PICKUP 1559 //Change this to the pickup model you prefer. Default: White arrow (diamond)
#define GARAGE_FREE_PICKUP 1273 //Change this to the pickup model you prefer. Default: Green house
#define GARAGE_OWNED_TEXT "Owner: %s\nLocked: %s" //This text will appear at all owned garages
#define GARAGE_FREE_TEXT "FOR SALE!\n Price: %d\n\nUse /buygarage to buy this garage." //This text will appear at all garages that are for sale
#define DD 200.0 //The streamdistance for the textlabels
//-- COLORS --//
#define TXTCOLOR 0xF9C50FFF //The textcolor for the textlabels
#define COLOR_USAGE 0xBB4D4DFF //The textcolor for the 'command usage' message
#define COLOR_SUCCESS 0x00AE00FF //The textcolor for the 'command sucessfull' message
#define COLOR_ERROR 0xFF0000FF //The textcolor for the 'error' message
#define COLOR_ORANGE 0xFFA500FF //The color orange
#define COLOR_LIGHTBLUE 0xADD8E6FF //The color light blue
////-- MySQL database/connection info. Only needed when using saving system number 3, MySQL. You can ignore this otherwise --////
#define HOST "localhost"
#define USER "root"
#define PASS ""
#define DataB "SAMP"
//
- Script comments
As you will see in the source code, I put some comments after code, to give you a better idea of what I'm doing. Again, if anything is unclear, ask here
- Screenshots
There's not much to show actually, but here are some screenshots anyways.
A garage for sale
A locked and owned garage
A unlocked and owned garage
Inside one of the garages
- Things for the next update:
- Ability to lend the garage key to other players
- Ability to sell the garage to other players
- Apply the fix to prevent you from walking out/driving out of the garage, causing you to fall to death.
- Reported bugs
- None yet
- Available commands
Code:/creategarage | /removegarage | /garagetypes | /genter | /gexit | /lockgarage | /buygarage | /sellgarage
- Requirements
- streamer - By Incognito
- sscanf - By ******
- zcmd - By Zeex
- MySQL Plugin R6 - by BlueG (if using the MySQL R6 based version)
- Dini - By DracoBlue (if using the dini based system)
- y_ini- By ****** (if using the y_ini based system)
Installation
- Version 1.1 and above
- Place jGarage.amx in your filterscripts folder
- Extract the scriptfiles folder from the archive. It contains the required folders, and the database file for the SQLite data.
- Add jGarage to the filterscripts line in your server.cfg (Note: it's cAsE SensiTive!)
- If you use the MySQL system, be sure to add the plugin to the plugins line.
- The default saving system is SQLite. If you want to use another saving system, open up the .pwn and check the systematic configuration section.
- If you're using the MySQL R6 version, be sure to upload the SQL dump to your database.
- Version 1.0b
- Dini version
- Place the jGarage.amx in your filterscripts folder
- Create the 'garages' folder in the scriptfiles directory (Important!)
- Add 'jGarage' to the filterscripts line in your server.cfg
- Non-threaded MySQL version
- Place the jGarage.amx in your filterscripts folder
- Upload the SQL dump into your MySQL database.
- Change the connection info inside the filterscript to your MySQL database connection info.
- Add 'jGarage' to the filterscripts line in your server.cfg
Downloads
- Version 1.2 (bug quickfix)
- Source (.pwn) - Pastebin
- Archive (.rar) - Download from jstylezzz.com
- SQL dump for the MySQL version - jstylezzz.com
- Old versions
- Universal version
- V1.1 Source (.pwn) - Pastebin
- V1.1 Archive (.rar) - Download from jstylezzz.com
- V1.1 SQL dump for the MySQL version - jstylezzz.com
- Dini version
- V1.0b - Pastebin
- V1.0b - Archive on jstylezzz.com
- V1.0b strcmp commands - Pastebin
- Non-threaded MySQL version
- V1.0b - Pastebin
- V1.0b strcmp commands - Pastebin
- V1.0b SQL Dump - jstylezzz.com
License
You are NOT allowed to re-upload or re-release this without my WRITTEN permission! Also don't claim it as your own, respect the author's work. As for the rest, you may use and modify this script as much as you wish, just leave the credits where they are.
Thanks!
Ps. If I forgot to mention anything in this thread, please tell me!