09.05.2011, 22:04
(
Последний раз редактировалось gamer931215; 13.05.2011 в 19:05.
)
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
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
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;
}
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 ""
****** 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: