[FilterScript] Advanced Vehicle Ownership & Dealership & Commands [EASILY CUSTOMIZABLE, DIALOG'S, PARK, APROX. 7,000 LINES & MORE]
#1

Advanced Vehicle Ownership & Dealership by DanishHaq
Information

Hi there, this is my vehicle ownership & dealership system. It approximates to a total of 7,000 lines and has some commands that I included for this release today. I use to use this script on my own server, I was the scripter there, but after the owner decided to close the server, I have nothing to do with it anymore as I am creating a better one. That's my reason why I decided to release this today. Also, this was my first "big" thing that I've done all myself and that I've had no help with whatsoever, and it's also my first release.

Disclaimer

As I don't need this anymore, you can do whatever you wish with it. But please, keep the credits line on top of your script, because at the end of the day, I did spend many hours on this, here's the credit information (all you have to add):

pawn Code:
/* ----- Vehicle ownership & dealership by DanishHaq - http://forum.sa-mp.com/member.php?u=138844 -----
----- This person has the rights to use this script in whatever shape or form they wish, but the credits must remain with the creator -----*/
Features

Below, you can find a list of features regarding this script, including the location of the dealership.

-- Fully integrated ownership into a users owner file.
-- The vehicle will be destroyed when that player logs off, and it will be recreated when that player logs back on (avoid too many vehicles on the server).
-- It's a dealership with dialog's, which means that you can pretty much add an unlimited amount of vehicles.
-- All the vehicles are included, except police vehicles (hydras, hunters, police cars etc.) and some big vehicles (dune, monster truck etc.)
-- You can easily add vehicles. Just look how I did it on the script (carefully), and then add whatever vehicle you'd like, same with removing it.
-- Parking system, vehicle number plate system, car color/colour system and a lot more.
-- It's got quite a few ready made commands for things you'd do with a vehicle, e.g. set the number plate, change the color/colour etc.
-- Cars & bikes, when you buy it, it will have a "first time" spawn near the dealership.
-- Boats spawn in the sea just at the Santa Marina Beach.
-- Helicopters spawn at the airport in Los Santos.

Screenshots

-- http://i.imgur.com/YH2iFWq.png
-- http://i.imgur.com/ZeaH6Ol.png
-- http://i.imgur.com/7C9ruGH.png
-- http://i.imgur.com/slFGAgJ.png
-- http://i.imgur.com/4GVzK3l.png
-- http://i.imgur.com/wYVkFLu.png
-- http://i.imgur.com/rLppvuF.png
-- http://i.imgur.com/lKdNMm5.png
-- http://i.imgur.com/3TyY3uQ.png
-- http://i.imgur.com/r5xdjtU.png
-- http://i.imgur.com/nTVysCd.png
-- http://i.imgur.com/7rxHQjK.png
-- http://i.imgur.com/8dn2GLc.png
-- http://i.imgur.com/TcaNyJt.png
-- http://i.imgur.com/o8phLJc.png
-- http://i.imgur.com/Td59wvx.png

Some information about the script

The car information saves on the actual user file of that user. I used y_ini in this case, if you want to use your own, you'll have to change the ownership system so it matches your own user file system, or change your existing system to y_ini.

The dealership itself uses dialog's, I have provided some random dialog ID's that the dialog's will get assigned to, but you should make sure that they don't overlap with your current dialog's. Dialog ID's used here are as follows: 3000, 3001, 3002, 3003, 3004, 3005, 3006, 3007, 3008, 3009, 3010 and 3011.

Unfortunately, I haven't had the time and haven't had the interest to create the following commands that you'll have to do yourself: /sellvehicle (sell it back to the ds) and /sellvehicleto (sell it to another player), possibly /exchangevehicle (exchange a vehicle with another player). I'd recommend that for advanced scripters.. if anyone will be kind enough to do it, I'll add it to this post, and you may keep the credits for those commands.

Method of installation

Ok, so this is the part that you'll have to pay the most attention too. For the y_ini users, you can do the following, for the rest, you'll have to optimize this so it will work with your own registration & logging in system.

Add all this to the top of your script, somewhere before main():

pawn Code:
#define DIALOG_CATEGORY 3000
#define DIALOG_AIRCRAFTS 3001
#define DIALOG_BIKES 3002
#define DIALOG_CONVERTIBLES 3003
#define DIALOG_INDUSTRIAL 3004
#define DIALOG_LOWRIDERS 3005
#define DIALOG_OFFROAD 3006
#define DIALOG_SALOONS 3007
#define DIALOG_SPORTVEHICLES 3008
#define DIALOG_STATIONWAGONS 3009
#define DIALOG_BOATS 3010
#define DIALOG_UNIQUEVEHICLES 3011
#define COLOR_GRAD6 0xF0F0F0FF
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x008000FF
#define COLOR_WHITE 0xFFFFFFFF

new personalcar1[MAX_PLAYERS];
new personalcar2[MAX_PLAYERS];
new personalcar3[MAX_PLAYERS];
Under "enum pInfo" (or whatever enum name you're using for your user file system), you will have to add the following:

pawn Code:
enum pInfo
{
    pVehicle1,
    pVehicle1Model,
    Float:pVehicle1X,
    Float:pVehicle1Y,
    Float:pVehicle1Z,
    Float:pVehicle1C,
    pVehicle1Color1,
    pVehicle1Color2,
    pVehicle1Value,
    pVehicle1Plate,
    pVehicle1Lock,
    pVehicle2,
    pVehicle2Model,
    Float:pVehicle2X,
    Float:pVehicle2Y,
    Float:pVehicle2Z,
    Float:pVehicle2C,
    pVehicle2Color1,
    pVehicle2Color2,
    pVehicle2Value,
    pVehicle2Plate,
    pVehicle2Lock,
    pVehicle3,
    pVehicle3Model,
    Float:pVehicle3X,
    Float:pVehicle3Y,
    Float:pVehicle3Z,
    Float:pVehicle3C,
    pVehicle3Color1,
    pVehicle3Color2,
    pVehicle3Value,
    pVehicle3Plate,
    pVehicle3Lock,
};
new PlayerInfo[MAX_PLAYERS][pInfo]; // if you've got something like this, leave this line, else, add it
Those are the variables that will be used in this script.

Now, wherever you have the part of the script where the user file will be loaded upon LOGIN, you need to add the following there:

pawn Code:
INI_Int("Vehicle1",PlayerInfo[playerid][pVehicle1]);
INI_Int("Vehicle1Model",PlayerInfo[playerid][pVehicle1Model]);
INI_Float("Vehicle1X",PlayerInfo[playerid][pVehicle1X]);
INI_Float("Vehicle1Y",PlayerInfo[playerid][pVehicle1Y]);
INI_Float("Vehicle1Z",PlayerInfo[playerid][pVehicle1Z]);
INI_Float("Vehicle1C",PlayerInfo[playerid][pVehicle1C]);
INI_Int("Vehicle1Color1",PlayerInfo[playerid][pVehicle1Color1]);
INI_Int("Vehicle1Color2",PlayerInfo[playerid][pVehicle1Color2]);
INI_Int("Vehicle1Value",PlayerInfo[playerid][pVehicle1Value]);
INI_String("Vehicle1Plate",PlayerInfo[playerid][pVehicle1Plate]);
INI_Int("Vehicle1Lock",PlayerInfo[playerid][pVehicle1Lock]);
INI_Int("Vehicle2",PlayerInfo[playerid][pVehicle2]);
INI_Int("Vehicle2Model",PlayerInfo[playerid][pVehicle2Model]);
INI_Float("Vehicle2X",PlayerInfo[playerid][pVehicle2X]);
INI_Float("Vehicle2Y",PlayerInfo[playerid][pVehicle2Y]);
INI_Float("Vehicle2Z",PlayerInfo[playerid][pVehicle2Z]);
INI_Float("Vehicle2C",PlayerInfo[playerid][pVehicle2C]);
INI_Int("Vehicle2Color1",PlayerInfo[playerid][pVehicle2Color1]);
INI_Int("Vehicle2Color2",PlayerInfo[playerid][pVehicle2Color2]);
INI_Int("Vehicle2Value",PlayerInfo[playerid][pVehicle2Value]);
INI_String("Vehicle2Plate",PlayerInfo[playerid][pVehicle2Plate]);
INI_Int("Vehicle2Lock",PlayerInfo[playerid][pVehicle2Lock]);
INI_Int("Vehicle3",PlayerInfo[playerid][pVehicle3]);
INI_Int("Vehicle3Model",PlayerInfo[playerid][pVehicle3Model]);
INI_Float("Vehicle3X",PlayerInfo[playerid][pVehicle3X]);
INI_Float("Vehicle3Y",PlayerInfo[playerid][pVehicle3Y]);
INI_Float("Vehicle3Z",PlayerInfo[playerid][pVehicle3Z]);
INI_Float("Vehicle3C",PlayerInfo[playerid][pVehicle3C]);
INI_Int("Vehicle3Color1",PlayerInfo[playerid][pVehicle3Color1]);
INI_Int("Vehicle3Color2",PlayerInfo[playerid][pVehicle3Color2]);
INI_Int("Vehicle3Value",PlayerInfo[playerid][pVehicle3Value]);
INI_String("Vehicle3Plate",PlayerInfo[playerid][pVehicle3Plate]);
INI_Int("Vehicle3Lock",PlayerInfo[playerid][pVehicle3Lock]);
This will be easier for us to use the variables with a simple PlayerInfo[playerid][variable] instead of using INI_WriteInt etc. all the time when we want to edit something in a player's user file.

The following, you need to add under the response to where the player gets registered on the server, and a new file will be created:

pawn Code:
INI_WriteInt(File,"Vehicle1",PlayerInfo[playerid][pVehicle1]);
INI_WriteInt(File,"Vehicle1Model",PlayerInfo[playerid][pVehicle1Model]);
INI_WriteFloat(File,"Vehicle1X",PlayerInfo[playerid][pVehicle1X]);
INI_WriteFloat(File,"Vehicle1Y",PlayerInfo[playerid][pVehicle1Y]);
INI_WriteFloat(File,"Vehicle1Z",PlayerInfo[playerid][pVehicle1Z]);
INI_WriteFloat(File,"Vehicle1C",PlayerInfo[playerid][pVehicle1C]);
INI_WriteInt(File,"Vehicle1Color1",PlayerInfo[playerid][pVehicle1Color1]);
INI_WriteInt(File,"Vehicle1Color2",PlayerInfo[playerid][pVehicle1Color2]);
INI_WriteInt(File,"Vehicle1Value",PlayerInfo[playerid][pVehicle1Value]);
INI_WriteString(File,"Vehicle1Plate",PlayerInfo[playerid][pVehicle1Plate]);
INI_WriteInt(File,"Vehicle1Lock",PlayerInfo[playerid][pVehicle1Lock]);
INI_WriteInt(File,"Vehicle2",PlayerInfo[playerid][pVehicle2]);
INI_WriteInt(File,"Vehicle2Model",PlayerInfo[playerid][pVehicle2Model]);
INI_WriteFloat(File,"Vehicle2X",PlayerInfo[playerid][pVehicle2X]);
INI_WriteFloat(File,"Vehicle2Y",PlayerInfo[playerid][pVehicle2Y]);
INI_WriteFloat(File,"Vehicle2Z",PlayerInfo[playerid][pVehicle2Z]);
INI_WriteFloat(File,"Vehicle2C",PlayerInfo[playerid][pVehicle2C]);
INI_WriteInt(File,"Vehicle2Color1",PlayerInfo[playerid][pVehicle2Color1]);
INI_WriteInt(File,"Vehicle2Color2",PlayerInfo[playerid][pVehicle2Color2]);
INI_WriteInt(File,"Vehicle2Value",PlayerInfo[playerid][pVehicle2Value]);
INI_WriteString(File,"Vehicle2Plate",PlayerInfo[playerid][pVehicle2Plate]);
INI_WriteInt(File,"Vehicle2Lock",PlayerInfo[playerid][pVehicle2Lock]);
INI_WriteInt(File,"Vehicle3",PlayerInfo[playerid][pVehicle3]);
INI_WriteInt(File,"Vehicle3Model",PlayerInfo[playerid][pVehicle3Model]);
INI_WriteFloat(File,"Vehicle3X",PlayerInfo[playerid][pVehicle3X]);
INI_WriteFloat(File,"Vehicle3Y",PlayerInfo[playerid][pVehicle3Y]);
INI_WriteFloat(File,"Vehicle3Z",PlayerInfo[playerid][pVehicle3Z]);
INI_WriteFloat(File,"Vehicle3C",PlayerInfo[playerid][pVehicle3C]);
INI_WriteInt(File,"Vehicle3Color1",PlayerInfo[playerid][pVehicle3Color1]);
INI_WriteInt(File,"Vehicle3Color2",PlayerInfo[playerid][pVehicle3Color2]);
INI_WriteInt(File,"Vehicle3Value",PlayerInfo[playerid][pVehicle3Value]);
INI_WriteString(File,"Vehicle3Plate",PlayerInfo[playerid][pVehicle3Plate]);
INI_WriteInt(File,"Vehicle3Lock",PlayerInfo[playerid][pVehicle3Lock]);
Now, if the player was successful with his login (he got the password right and he has been logged in), add the following:

pawn Code:
if(PlayerInfo[playerid][pVehicle1] != 0)
{
    new model1 = PlayerInfo[playerid][pVehicle1Model];
    new Float:car1x = PlayerInfo[playerid][pVehicle1X];
    new Float:car1y = PlayerInfo[playerid][pVehicle1Y];
    new Float:car1z = PlayerInfo[playerid][pVehicle1Z];
    new Float:car1c = PlayerInfo[playerid][pVehicle1C];
    new car1color1 = PlayerInfo[playerid][pVehicle1Color1];
    new car1color2 = PlayerInfo[playerid][pVehicle1Color2];
    new car1lock = PlayerInfo[playerid][pVehicle1Lock];
    personalcar1[playerid] = CreateVehicle(model1, car1x, car1y, car1z, car1c, car1color1, car1color2, 999999);
    SetVehicleNumberPlate(personalcar1[playerid], PlayerInfo[playerid][pVehicle1Plate]);
    if(car1lock != 0)
    {
        GetVehicleParamsEx(personalcar1[playerid], engine, lights, alarm, doors, bonnet, boot, objective);
        SetVehicleParamsEx(personalcar1[playerid], engine, lights, alarm, 1, bonnet, boot, objective);
    }
}
if(PlayerInfo[playerid][pVehicle2] != 0)
{
    new model2 = PlayerInfo[playerid][pVehicle2Model];
    new Float:car2x = PlayerInfo[playerid][pVehicle2X];
    new Float:car2y = PlayerInfo[playerid][pVehicle2Y];
    new Float:car2z = PlayerInfo[playerid][pVehicle2Z];
    new Float:car2c = PlayerInfo[playerid][pVehicle2C];
    new car2color1 = PlayerInfo[playerid][pVehicle2Color1];
    new car2color2 = PlayerInfo[playerid][pVehicle2Color2];
    new car2lock = PlayerInfo[playerid][pVehicle2Lock];
    personalcar2[playerid] = CreateVehicle(model2, car2x, car2y, car2z, car2c, car2color1, car2color2, 999999);
    SetVehicleNumberPlate(personalcar2[playerid], PlayerInfo[playerid][pVehicle2Plate]);
    if(car2lock != 0)
    {
        GetVehicleParamsEx(personalcar2[playerid], engine, lights, alarm, doors, bonnet, boot, objective);
        SetVehicleParamsEx(personalcar2[playerid], engine, lights, alarm, 1, bonnet, boot, objective);
    }
}
if(PlayerInfo[playerid][pVehicle3] != 0)
{
    new model3 = PlayerInfo[playerid][pVehicle3Model];
    new Float:car3x = PlayerInfo[playerid][pVehicle3X];
    new Float:car3y = PlayerInfo[playerid][pVehicle3Y];
    new Float:car3z = PlayerInfo[playerid][pVehicle3Z];
    new Float:car3c = PlayerInfo[playerid][pVehicle3C];
    new car3color1 = PlayerInfo[playerid][pVehicle3Color1];
    new car3color2 = PlayerInfo[playerid][pVehicle3Color2];
    new car3lock = PlayerInfo[playerid][pVehicle3Lock];
    personalcar3[playerid] = CreateVehicle(model3, car3x, car3y, car3z, car3c, car3color1, car3color2, 999999);
    SetVehicleNumberPlate(personalcar3[playerid], PlayerInfo[playerid][pVehicle3Plate]);
    if(car3lock != 0)
    {
        GetVehicleParamsEx(personalcar3[playerid], engine, lights, alarm, doors, bonnet, boot, objective);
        SetVehicleParamsEx(personalcar3[playerid], engine, lights, alarm, 1, bonnet, boot, objective);
    }
}
This will spawn their vehicle(s) if they own any, at their parked positions.

Under OnPlayerDisconnect(playerid), you'll want to add the following code so it will destroy his vehicle, as where we logged in, it spawns the vehicle, we don't want it to keep spawning an extra vehicle when that player logs in:

pawn Code:
DestroyVehicle(personalcar1[playerid]);
DestroyVehicle(personalcar2[playerid]);
DestroyVehicle(personalcar3[playerid]);
Now, that's the vehicle ownership system done. Next, we need to do the dealership system. I won't use the pawn tags as the following has approximately 6,800 lines, so I'll put it on pastebin into different sections so it's digestible.

The following needs to be added under OnPlayerCommandText, just copy the raw paste data towards the bottom of the page and then add it to your script so the alignments are fine, instead of left right and center as shown on the pastebin site, here's the link to OnPlayerCommandText.

Now, the following you need to add under OnDialogResponse for that player, this is called when the player will respond to the dialog. Here's the link to OnDialogResponse.

The end

That's all, you've done it. Remember, use this however you want. If you liked this, don't forget to rep me, that'd be appreciated! I'm waiting for your queries and comments via reply. Thanks for reading!
Reply
#2

I like it, very useful! I believe you really worked hard on this, and it is worth it! Rep+ for this!
Reply
#3

Quote:
Originally Posted by Dragonsaurus
View Post
I like it, very useful! I believe you really worked hard on this, and it is worth it! Rep+ for this!
Thanks.. and yea, I spent around 3-4 days, trial and error . It was a major update to the server that I put it on, they all loved it. Thanks for the rep .
Reply
#4

good will test it
Reply
#5

Quote:
Originally Posted by Team_PRO
View Post
good will test it
Tell me what it's like when you've tested it .

PS: You might get a few errors saying undefined symbol: COLOR_colorhere. I might have forgot to put them in, just reply here, tell me, and I'll give you the colors.
Reply
#6

Quote:
Originally Posted by DanishHaq
View Post
Tell me what it's like when you've tested it .

PS: You might get a few errors saying undefined symbol: COLOR_colorhere. I might have forgot to put them in, just reply here, tell me, and I'll give you the colors.
well its easy to use good for the roleplay for my cousins server


PS: i can fix error or warnings
Reply
#7

Thanks awesome! i will test it now.
Reply
#8

Nice one!
Reply
#9

Man i have errors.. :/
PHP Code:
gamemodes\cInfo2.pwn(95) : error 017undefined symbol "engine"
gamemodes\cInfo2.pwn(96) : error 017undefined symbol "engine"
gamemodes\cInfo2.pwn(113) : error 017undefined symbol "engine"
gamemodes\cInfo2.pwn(114) : error 017undefined symbol "engine"
gamemodes\cInfo2.pwn(131) : error 017undefined symbol "engine"
gamemodes\cInfo2.pwn(132) : error 017undefined symbol "engine"
gamemodes\cInfo2.pwn(135) : error 017undefined symbol "name"
gamemodes\cInfo2.pwn(135) : error 017undefined symbol "value"
gamemodes\cInfo2.pwn(136) : error 017undefined symbol "name"
gamemodes\cInfo2.pwn(136) : error 017undefined symbol "value"
gamemodes\cInfo2.pwn(137) : error 017undefined symbol "name"
gamemodes\cInfo2.pwn(137) : error 017undefined symbol "value"
gamemodes\cInfo2.pwn(138) : error 017undefined symbol "name"
gamemodes\cInfo2.pwn(138) : error 017undefined symbol "value"
gamemodes\cInfo2.pwn(139) : error 017undefined symbol "name"
gamemodes\cInfo2.pwn(139) : error 017undefined symbol "value"
gamemodes\cInfo2.pwn(140) : error 017undefined symbol "name"
gamemodes\cInfo2.pwn(140) : error 017undefined symbol "value"
gamemodes\cInfo2.pwn(141) : error 017undefined symbol "name"
gamemodes\cInfo2.pwn(141) : error 017undefined symbol "value"
gamemodes\cInfo2.pwn(142) : error 017undefined symbol "name"
gamemodes\cInfo2.pwn(142) : error 017undefined symbol "value"
gamemodes\cInfo2.pwn(143) : error 017undefined symbol "name"
gamemodes\cInfo2.pwn(143) : error 017undefined symbol "value"
gamemodes\cInfo2.pwn(144) : error 017undefined symbol "INI_String"
gamemodes\cInfo2.pwn(145) : error 017undefined symbol "name"

Compilation aborted.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase


26 Errors

:/
Reply
#10

Quote:
Originally Posted by radiobizza
View Post
Man i have errors.. :/
PHP Code:
gamemodes\cInfo2.pwn(95) : error 017undefined symbol "engine"
gamemodes\cInfo2.pwn(96) : error 017undefined symbol "engine"
gamemodes\cInfo2.pwn(113) : error 017undefined symbol "engine"
gamemodes\cInfo2.pwn(114) : error 017undefined symbol "engine"
gamemodes\cInfo2.pwn(131) : error 017undefined symbol "engine"
gamemodes\cInfo2.pwn(132) : error 017undefined symbol "engine"
gamemodes\cInfo2.pwn(135) : error 017undefined symbol "name"
gamemodes\cInfo2.pwn(135) : error 017undefined symbol "value"
gamemodes\cInfo2.pwn(136) : error 017undefined symbol "name"
gamemodes\cInfo2.pwn(136) : error 017undefined symbol "value"
gamemodes\cInfo2.pwn(137) : error 017undefined symbol "name"
gamemodes\cInfo2.pwn(137) : error 017undefined symbol "value"
gamemodes\cInfo2.pwn(138) : error 017undefined symbol "name"
gamemodes\cInfo2.pwn(138) : error 017undefined symbol "value"
gamemodes\cInfo2.pwn(139) : error 017undefined symbol "name"
gamemodes\cInfo2.pwn(139) : error 017undefined symbol "value"
gamemodes\cInfo2.pwn(140) : error 017undefined symbol "name"
gamemodes\cInfo2.pwn(140) : error 017undefined symbol "value"
gamemodes\cInfo2.pwn(141) : error 017undefined symbol "name"
gamemodes\cInfo2.pwn(141) : error 017undefined symbol "value"
gamemodes\cInfo2.pwn(142) : error 017undefined symbol "name"
gamemodes\cInfo2.pwn(142) : error 017undefined symbol "value"
gamemodes\cInfo2.pwn(143) : error 017undefined symbol "name"
gamemodes\cInfo2.pwn(143) : error 017undefined symbol "value"
gamemodes\cInfo2.pwn(144) : error 017undefined symbol "INI_String"
gamemodes\cInfo2.pwn(145) : error 017undefined symbol "name"
Compilation aborted.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
26 Errors

:/
What's line 95 -- 145?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)