[FilterScript] jGarage - Dynamic garages
#1

jGarage - Dynamic garages
by Jstylezzz

Introduction

  • Why this script?
Hi all
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.
Information

  • Things you can configure
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"
//
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.
  • 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

Installation
  • Version 1.1 and above

    1. Place jGarage.amx in your filterscripts folder
    2. Extract the scriptfiles folder from the archive. It contains the required folders, and the database file for the SQLite data.
    3. Add jGarage to the filterscripts line in your server.cfg (Note: it's cAsE SensiTive!)
    4. If you use the MySQL system, be sure to add the plugin to the plugins line.
    5. The default saving system is SQLite. If you want to use another saving system, open up the .pwn and check the systematic configuration section.
    6. If you're using the MySQL R6 version, be sure to upload the SQL dump to your database.

  • Version 1.0b

    • Dini version
    1. Place the jGarage.amx in your filterscripts folder
    2. Create the 'garages' folder in the scriptfiles directory (Important!)
    3. Add 'jGarage' to the filterscripts line in your server.cfg
    • Non-threaded MySQL version
    1. Place the jGarage.amx in your filterscripts folder
    2. Upload the SQL dump into your MySQL database.
    3. Change the connection info inside the filterscript to your MySQL database connection info.
    4. Add 'jGarage' to the filterscripts line in your server.cfg



Downloads

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!
Reply
#2

Looks nice man! I can see you've put a lot of effort into this. I'll be sure to check it out
Reply
#3

Dini is the only thing I don't like about this, but as you said, you could create a y_ini and mysql version aswell...
Looking good, I think many people could use this.
Reply
#4

Quote:
Originally Posted by Zjiht
View Post
Looks nice man! I can see you've put a lot of effort into this. I'll be sure to check it out
Quote:
Originally Posted by Strawhats
View Post
Dini is the only thing I don't like about this, but as you said, you could create a y_ini and mysql version aswell...
Looking good, I think many people could use this.
Thanks guys. I do realize Dini is the turn-off here, and my idea is to get a MySQL version up soon. (Threaded and Non-Threaded, 2 versions).
Reply
#5

Looks pretty good, bro! But does it just use the one interior? Or will there be multiples to choose from?
Reply
#6

Quote:
Originally Posted by justsomeguy
View Post
Looks pretty good, bro! But does it just use the one interior? Or will there be multiples to choose from?
Thanks There are multiple interiors. In the script there's an array containing coordinates that lead to an interior. At this moment there are 3 interiors to choose from; 1. Small garage, 2. Medium garage, and 3. Big garage.
People can add their own if they have mapped garages for example.

Update

  • Made a non-threaded MySQL version, using BlueG's R6 plugin.
Check the main thread for the download and on how to install.
Reply
#7

This is awesome man. Rep+
Reply
#8

Looks awesome, had this idea like a year ago, never made it though!
Great job man, +rep for the idea, will script my own for my server though (as I'd like to import it to the house system).
Great job, once again
Reply
#9

Can a car enter in it ?
Reply
#10

Quote:
Originally Posted by Wayland
View Post
This is awesome man. Rep+
Quote:
Originally Posted by ivanorezac
View Post
Looks awesome, had this idea like a year ago, never made it though!
Great job man, +rep for the idea, will script my own for my server though (as I'd like to import it to the house system).
Great job, once again
Thanks

Quote:
Originally Posted by anou1
View Post
Can a car enter in it ?
Yes. If you're standing on the pickup while in a car, you and the car will be teleported inside.
Reply
#11

OMG, 100% usefull !

Do it work with R35 plugin ? (mysql)
https://sampforum.blast.hk/showthread.php?tid=56564


Is that possible to integrate it in a Gamemode instead of a FS ?
Reply
#12

Quote:
Originally Posted by anou1
View Post
OMG, 100% usefull !
Cool, thanks

Quote:
Originally Posted by anou1
View Post
Do it work with R35 plugin ? (mysql)
https://sampforum.blast.hk/showthread.php?tid=56564
It doesn't work with versions higer than R6 for now, as those use threaded queries. I am planning on making a threaded MySQL version with the newest version of the plugin. Not sure why though, I have some exams coming up to study for :P

Quote:
Originally Posted by anou1
View Post
Is that possible to integrate it in a Gamemode instead of a FS ?
Yeah, just place the 'custom functions' of the code into your game mode, and add the things from OnFilterScriptInit to OnGameModeInit in your gamemode.
Reply
#13

Okay, thank you !

I will wait the threaded MySQL version
Reply
#14

there is a great filterscript
Reply
#15

Hi this system works great. Although I have one issue. I can play and use the garage system over and over again, I can reset the server using gmx 5 or 6 times. But after the server has been reset quite a few times, the pickups and 3d text for the garages appear, but when you type /genter near them, nothing happens... Does anyone know a solution to this?

I created a /mygarages command to try and find out what the issue is and it says that I own garageUID 0, when actually I own UID 5.

Thanks in advance
Reply
#16

Nice script.
Reply
#17

Quote:
Originally Posted by lewismichaelbbc
View Post
Hi this system works great. Although I have one issue. I can play and use the garage system over and over again, I can reset the server using gmx 5 or 6 times. But after the server has been reset quite a few times, the pickups and 3d text for the garages appear, but when you type /genter near them, nothing happens... Does anyone know a solution to this?

I created a /mygarages command to try and find out what the issue is and it says that I own garageUID 0, when actually I own UID 5.

Thanks in advance
I'm not sure about this one to be honest.. Have you tried reloading the filterscripts after resetting the server?
Reply
#18

nice filterscript
i have the same problem /genter wont work
when you are close to the garage it says unknown cmd.
but the command works cuz when i type /genter when im not near the checkpoint it says " you arent near any garage"
so this means the problem with the cmd /genter is when you are near the checkpoint it cant read the cmd
Reply
#19

I'm not sure what the problem is here, as it works fine for me. (I just downloaded the standard SA-MP server package and loaded the script. Everything works fine there).
Are you experiencing these problems when using GMX? If so, be sure to use the following code under OnGameModeInit:
pawn Code:
SendRconCommand("unloadfs jGarage");
SendRconCommand("loadfs jGarage");
I know there is a command called 'reloadfs', but this one gave me problems, just like the GMX command did/does.

Also, be sure that the garage type is a valid, defined type. If you have a type that is not created in the script, it will probably say unknown command.
Let me know if it solves anything, if it doesn't solve the problem, we'll have to look into it a little deeper.
Reply
#20

Amazing script, I just have one nitpick, I use Y_INI, so I need a Y_INI if you don't mind making a version for it?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)