SA-MP Forums Archive
[Include] vDealer, probally the most simple vehicledealer system (Supports Y_INI & MYSQL!) Make your own vehicleshops in 1 line! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] vDealer, probally the most simple vehicledealer system (Supports Y_INI & MYSQL!) Make your own vehicleshops in 1 line! (/showthread.php?tid=254251)

Pages: 1 2 3


vDealer, probally the most simple vehicledealer system (Supports Y_INI & MYSQL!) Make your own vehicleshops in 1 line! - gamer931215 - 09.05.2011

vDealer 1.1
What is it ?
vDealer is an include that allows you VERY EASILY to create vehicledealers anywhere you like.
It has the following features:

*Userfriendly dialogged gui!
*Very easy system (you can create a store with just 1 command!)
*You can add the vehicles per shop yourself!
*A pickup, mapicon and 3DTextLabel will be created
*The labels & pickup will be streamed with the build-in streamer
*System supports Y_INI for fast filewriting, AND MYSQL in case you preffer to use a database
*All bought vehicles are private for the owner only
*The player can use /park to save his vehicle position
*The player can use /sellvehicle to sell the vehicle for 20% of his original price (Can be adjusted in the defines)
*A LOT of extra options/features in the defines


Rewards


Changelog
Код:
V1.1:
- Bug fixed with dialogspam (thanks to [KO]KillerThriller for reporting)
- You can now define the pickupmodel if you want to change it
- System can now also use checkpoints instead of pickups
- OnGameModeInit bug fixed (i failed, lol)
- System is now using Incognito's streamer
- Multiple other bugs are fixed
Screenshots
I took these on my old crappy pc, so sorry for the quality
This is an exampleshop at Wang's cars:



This is how the dialogs looks like:


Functions
Код:
	native CreateVehicleDealer(dealername[],Float:x,Float:y,Float:z) // returns dealerid
	native ToggleDealer(dealerid,toggle)
	native AddVehicleToDealer(dealerid,vehiclename[],modelid,price) // returns dealer-vehicle id
	native ToggleDealerVehicle(dealerid,dealervehicleid,toggle)
	vDEALER: // defines 'New ', so you can easy save the shopid
Example how to use
pawn Код:
#include <a_samp>
#define FILTERSCRIPT //ALWAYS define this if your including it into a filterscript
#include <vdealer>

public OnFilterScriptInit()
{
    //vDEALER: dealername = CreateVehicleDealer(name[],x,y,z);
    vDEALER: wang_cars = CreateVehicleDealer("Wang Car's",-1974.075439, 280.052734, 34.742362);
    //AddVehicleToDealer(dealerid,vehiclename[],vehiclemodelid,price);
    AddVehicleToDealer(wang_cars,"Sabre",475,5000);
    AddVehicleToDealer(wang_cars,"Turismo",451,15000);
    AddVehicleToDealer(wang_cars,"SuperGT",506,20000);
    AddVehicleToDealer(wang_cars,"Infernus",411,25000);
   
   
    //another shop
    vDEALER: farmer_shop = CreateVehicleDealer("Farmer Shop",-7.8484,53.6393,3.1172);
    AddVehicleToDealer(farmer_shop,"Tractor",531,3000);
   
    //Example how to disable a vehicle in the dealerlist
    new combine = AddVehicleToDealer(farmer_shop,"Combine Harvester",532,20000);
    ToggleDealerVehicle(farmer_shop,combine,0); //0 = disabled, 1 = enabled
    return 1;
}
Define options
pawn Код:
#define RESPAWN_DELAY       5000    //Respawn time in miliseconds
#define DIALOG_RANGE        0       //dialog range
#define MAP_ICON            55      //mapicon for dealer
#define MAP_ICON_ID         1337    //Temporary mapicon ID when a dealer is streamed (to avoid any of your own mapicons to got removed)

//sell vehicle settings
#define SELL_DIVIDE         5       //Original price / SELL_DIVIDE = sellback money you get

//streamer settings
#define STREAMER_DISTANCE   100     //Streamdistance for the build-in streamer
#define STREAMER_INTERVAL   1000    //Streamer tickratio (due to the loops, this shouldnt be really lower as 600-700 i think, i recommend setting it to 1000 though)

//FILEPATHS
#define VEHICLE_PATH        "vDealer_vehicles/%i.ini"

//SQL Settings:
#define USE_MYSQL_DATABASE  false
#define SQL_SERVER          "localhost"
#define SQL_TABLE           "vDealer_vehicles"
#define SQL_USER            "root"
#define SQL_PASS            ""
Credits
****** for sscanf2
****** for YSI
G-sTyLeZzZ - MySQL plugin
Zeex for zcmd
Me for yoursql and the main script

Downloadlink
If you just want to take a "peek" on the source, heres a pastebin link.

Fixed version!
All files:


Re: vDealer, probally the most simple vehicledealer system (Supports Y_INI & MYSQL!) Make your own vehicleshops in 1 lin - [KO]KillerThriller - 09.05.2011

Awesome!!!


Re: vDealer, probally the most simple vehicledealer system (Supports Y_INI & MYSQL!) Make your own vehicleshops in 1 lin - Ironboy - 10.05.2011

Awesome work dude


Re: vDealer, probally the most simple vehicledealer system (Supports Y_INI & MYSQL!) Make your own vehicleshops in 1 lin - Crusher!! - 10.05.2011

Nice man.!


Re: vDealer, probally the most simple vehicledealer system (Supports Y_INI & MYSQL!) Make your own vehicleshops in 1 lin - WarServers - 10.05.2011

Going to give it ago!


Re: vDealer, probally the most simple vehicledealer system (Supports Y_INI & MYSQL!) Make your own vehicleshops in 1 lin - lowrida018 - 10.05.2011

Thank you, I have been looking for one of these!


Respuesta: vDealer, probally the most simple vehicledealer system (Supports Y_INI & MYSQL!) Make your own vehicleshops i - Host-samp - 10.05.2011

nice


Re: vDealer, probally the most simple vehicledealer system (Supports Y_INI & MYSQL!) Make your own vehicleshops in 1 lin - Skaizo - 10.05.2011

I created fs that in 25 minutes,cool include


Re: vDealer, probally the most simple vehicledealer system (Supports Y_INI & MYSQL!) Make your own vehicleshops in 1 lin - [KO]KillerThriller - 10.05.2011

Suggestion:
Make it choosable between:
-Checkpoint
or
-Pickup


Re: vDealer, probally the most simple vehicledealer system (Supports Y_INI & MYSQL!) Make your own vehicleshops in 1 lin - Skaizo - 10.05.2011

Quote:
Originally Posted by [KO]KillerThriller
Посмотреть сообщение
Suggestion:
Make it choosable between:
-Checkpoint
or
-Pickup
A pickup


Respuesta: vDealer, probally the most simple vehicledealer system (Supports Y_INI & MYSQL!) Make your own vehicleshops i - SuperMarioRol - 10.05.2011

Really gooood!!

Congratulations


Re: vDealer, probally the most simple vehicledealer system (Supports Y_INI & MYSQL!) Make your own vehicleshops in 1 lin - ellyx - 10.05.2011

AWESOME ! ! !




Re: vDealer, probally the most simple vehicledealer system (Supports Y_INI & MYSQL!) Make your own vehicleshops in 1 lin - gamer931215 - 10.05.2011

Quote:
Originally Posted by [RSS]Cops_sandu
Посмотреть сообщение
Quote:
Originally Posted by [KO]KillerThriller
Посмотреть сообщение
Suggestion:
Make it choosable between:
-Checkpoint
or
-Pickup
A pickup
@[RSS]Cops_sandu: What do you mean ? this alreay has a pickup

@[KO]KillerThriller: i dont really see the point why you would use a checkpoint..


Anyway thanks all for the comments i appreciate


Re: vDealer, probally the most simple vehicledealer system (Supports Y_INI & MYSQL!) Make your own vehicleshops in 1 lin - [KO]KillerThriller - 10.05.2011

Quote:
Originally Posted by gamer931215
Посмотреть сообщение
@[RSS]Cops_sandu: What do you mean ? this alreay has a pickup

@[KO]KillerThriller: i dont really see the point why you would use a checkpoint..


Anyway thanks all for the comments i appreciate
"i dont really see the point why you would use a checkpoint.."
Seriously?
What is most popular in all servers, using vehicle ownership systems?
Checkpoints...
Still it's a suggestion, and a good one.


Re: vDealer, probally the most simple vehicledealer system (Supports Y_INI & MYSQL!) Make your own vehicleshops in 1 lin - gamer931215 - 10.05.2011

Quote:
Originally Posted by [KO]KillerThriller
Посмотреть сообщение
"i dont really see the point why you would use a checkpoint.."
Seriously?
What is most popular in all servers, using vehicle ownership systems?
Checkpoints...
Still it's a suggestion, and a good one.
Il might add it if you think its so important (maybe other people want it too), but still i dont see the (functional) point....


Re: vDealer, probally the most simple vehicledealer system (Supports Y_INI & MYSQL!) Make your own vehicleshops in 1 lin - barneystinson - 10.05.2011

Nice job although i did find a few minor things lol

Green & Orange colours when choosing your colour need switching round :P

Maybe it was me but anything more than 5 vehicles in the vehicle selection menu refuses to show up in the dialog (it's late lol could be me)


Re: vDealer, probally the most simple vehicledealer system (Supports Y_INI & MYSQL!) Make your own vehicleshops in 1 lin - Meinstad - 11.05.2011

Really good work!


Respuesta: vDealer, probally the most simple vehicledealer system (Supports Y_INI & MYSQL!) Make your own vehicleshops i - SuperMarioRol - 11.05.2011

I've a problem.

I insert it in my GF/LARP edit.
I dont use SQL, I use, y_ini.
I start the server but see the GM unknown.
їAny solutions?
(Incognito's stremaer and sscanf loads)

EDIT: Now, using SQL, saya that file is compiled but no show nothing in the compiler window (A { or } isnt correct)
I only edit the defines of the inc
pawn Код:
#define USE_MYSQL_DATABASE  false
#define SQL_SERVER          "***.***.***.***"
#define SQL_TABLE           "***_***"
#define SQL_USER            "***_*****"
#define SQL_PASS            "*****"



Re: Respuesta: vDealer, probally the most simple vehicledealer system (Supports Y_INI & MYSQL!) Make your own vehiclesho - gamer931215 - 11.05.2011

Quote:
Originally Posted by SuperMarioRol
Посмотреть сообщение
I've a problem.

I insert it in my GF/LARP edit.
I dont use SQL, I use, y_ini.
I start the server but see the GM unknown.
їAny solutions?
(Incognito's stremaer and sscanf loads)

EDIT: Now, using SQL, saya that file is compiled but no show nothing in the compiler window (A { or } isnt correct)
I only edit the defines of the inc
pawn Код:
#define USE_MYSQL_DATABASE  false
#define SQL_SERVER          "***.***.***.***"
#define SQL_TABLE           "***_***"
#define SQL_USER            "***_*****"
#define SQL_PASS            "*****"
Thats odd, that part works fine here at GrandLarc & LVDM...
however i discovered some bugs, so im trying to fix it arround tomorrow
check it tomorrow again.


Re: Respuesta: vDealer, probally the most simple vehicledealer system (Supports Y_INI & MYSQL!) Make your own vehiclesho - gamer931215 - 13.05.2011

Quote:
Originally Posted by [KO]KillerThriller
Посмотреть сообщение
Suggestion:
Make it choosable between:
-Checkpoint
or
-Pickup
Quote:
Originally Posted by barneystinson
Посмотреть сообщение
Nice job although i did find a few minor things lol

Green & Orange colours when choosing your colour need switching round :P

Maybe it was me but anything more than 5 vehicles in the vehicle selection menu refuses to show up in the dialog (it's late lol could be me)
Quote:
Originally Posted by SuperMarioRol
Посмотреть сообщение
I've a problem.

I insert it in my GF/LARP edit.
I dont use SQL, I use, y_ini.
I start the server but see the GM unknown.
їAny solutions?
(Incognito's stremaer and sscanf loads)

EDIT: Now, using SQL, saya that file is compiled but no show nothing in the compiler window (A { or } isnt correct)
I only edit the defines of the inc
pawn Код:
#define USE_MYSQL_DATABASE  false
#define SQL_SERVER          "***.***.***.***"
#define SQL_TABLE           "***_***"
#define SQL_USER            "***_*****"
#define SQL_PASS            "*****"

Thanks all for the bug reports
all bugs should be fixed now in Version 1.1:
Changelog
Код:
V1.1:
- Bug fixed with dialogspam (thanks to [KO]KillerThriller for reporting)
- You can now define the pickupmodel if you want to change it
- System can now also use checkpoints instead of pickups
- OnGameModeInit bug fixed (i failed, lol)
- System is now using Incognito's streamer
- Multiple other bugs are fixed