Hya chaps,
Here is a complete Buycar/Sellcar script for public use.
please let me know of any issues you may have. I have fully tested it on both 64 and 32 bit systems.
Commands are used with the '/' prefix and are as follows;
-------------------------
Included Files:
-------------------------
-------------------------
How it works:
-------------------------
INSTALL:
-------------------------
** NOTE:
You must first run 'sql_create.nut' and import the table to your database.
REMEMBER TO RUN IT AFTER YOU HAVE CREATED YOUR VEHICLES!!
1. Load the class
>> dofile("sunshine.nut");
2. Load the database data into the array.
>> SunshineAutos.LoadDatabase("sunshine.db");
3. We must save the array to the database on a regular basis ( once every 5 hours )
I reccomend triggering it in an event that is used frequently.
>> SunshineAutos.SaveDatabase("sunshine.db");
** NOTE:
Put s_cmds.nut in the same directory as you server.exe, or change the file paths.
-------------------------
STEP-BY-STEP INSTALL GUIDES
-------------------------
Method One - Using the old server.conf
Method Two - You created your vehicles using CreateVehicle()
Using the example Script
DOWNLOAD
Here is a complete Buycar/Sellcar script for public use.
please let me know of any issues you may have. I have fully tested it on both 64 and 32 bit systems.
Commands are used with the '/' prefix and are as follows;
- car- View information on that vehicle
- forsale- View vehicles that are forsale
- buycar- Purchase a vehicle
- sellcar- Sell a vehicle
- mycars- View your purchased vehicles
- sharecar- Share a vehicle
- delshare- Delete a shared vehicle
- sharedcars- View your shared vehicles
-------------------------
Included Files:
-------------------------
- sunshine.nut- The main class
- sql_create.nut- This iterates all server vehicles and adds them to a sql dump file, for you to import as a table into your database
- s_cmds.nut- Example in-game command triggers.
-------------------------
How it works:
-------------------------
- Reads the vehicle entries in the database, and creates a class instance for every entry.
- Places this instance into an array element, and sets the object properties.
- All changes can be done via the array now. ( no need to query the database, apart from loading/saving )
- The array index represents the in-game VehicleID.
For example: VehicleID 1, is in array index 1.
VehicleID 2, is in array index 2.
VehicleID 3, is in array index 3.
... etc etc etc ...
VehicleID 2, is in array index 2.
VehicleID 3, is in array index 3.
... etc etc etc ...
- Object-Properties - These can be set or retrieved in the same manor as any other class properties. ( all properties return null if no value is set )
- VehicleID
- VehicleModel
- VehicleCat
- VehiclePrice
- IsPurchased
- IsShared
INSTALL:
-------------------------
** NOTE:
You must first run 'sql_create.nut' and import the table to your database.
REMEMBER TO RUN IT AFTER YOU HAVE CREATED YOUR VEHICLES!!
1. Load the class
>> dofile("sunshine.nut");
2. Load the database data into the array.
>> SunshineAutos.LoadDatabase("sunshine.db");
3. We must save the array to the database on a regular basis ( once every 5 hours )
I reccomend triggering it in an event that is used frequently.
>> SunshineAutos.SaveDatabase("sunshine.db");
** NOTE:
Put s_cmds.nut in the same directory as you server.exe, or change the file paths.
-------------------------
STEP-BY-STEP INSTALL GUIDES
-------------------------
Method One - Using the old server.conf
Method Two - You created your vehicles using CreateVehicle()
Using the example Script
DOWNLOAD