Vehicle System

Started by KrlozZ..., Apr 26, 2017, 09:58 PM

Previous topic - Next topic

KrlozZ...

Hey, i have make a other vehicle system to Create vehicles, and owner things, i have get it from Luis_Baraca script just have make it SQL and put some modifcations.

Have tested it all, and it works fine, if you found some bug, tell me.
It uses sql. so be sure to get the plugin.

Credits:
Credits for Blank Script to sseebbyy.
Credits for Vehicle System to Luis_Labarca.
Credits for make it SQL to KrlozZ...
Credits for cmds "Removecar, Setowner, Carsforsale, Car, Driver" to KrlozZ...
Credits for Sharecar for 2 players to KrlozZ...

Cmds for Admins: addcar, changecol, changepos, removecar, setowner, carsforsale.
Cmds for players: buycar, sellcar, sharecar, delsharecar, mycars, mysharedcars, car, driver.

Here is it:


luchgox

Strength does not come from wining.Your struggles develop your strengths.

!


Discord: zeus#5155

KrlozZ...

Quote from: zeus on Apr 27, 2017, 07:04 AM
Quote from: KrlozZ... on Apr 26, 2017, 09:58 PMIt uses mysql. so be sure to get the plugin.

Quote from: KrlozZ... on Apr 26, 2017, 09:58 PMCredits for make it SQL to KrlozZ...
????

It was ini :p and i make it to use databases. ._. Thats.

!

Quote from: KrlozZ... on Apr 27, 2017, 07:06 AM
Quote from: zeus on Apr 27, 2017, 07:04 AM
Quote from: KrlozZ... on Apr 26, 2017, 09:58 PMIt uses mysql. so be sure to get the plugin.
????

It was ini :p and i make it to use databases. ._. Thats.

Quote from: ScriptVehicles <- ConnectSQL( "Databases/Vehicles.db" );
Its SQL not MySQL.

Discord: zeus#5155

KrlozZ...

Quote from: zeus on Apr 27, 2017, 07:11 AM
Quote from: KrlozZ... on Apr 27, 2017, 07:06 AM
Quote from: zeus on Apr 27, 2017, 07:04 AM
Quote from: KrlozZ... on Apr 26, 2017, 09:58 PMIt uses mysql. so be sure to get the plugin.
????

It was ini :p and i make it to use databases. ._. Thats.

Quote from: ScriptVehicles <- ConnectSQL( "Databases/Vehicles.db" );
Its SQL not MySQL.

Hmm ._. Kk my mistake, i edited it n.n

Zone_Killer

Bohemia Is God Of Punjabi Rap
Yo Yo Honey Singh tou chutiya hai

kennedyarz

Use this method, so there will be no need to restart the server so that the vehicle appears where I put it

    else if (cmd=="park")
    {
    if ( !player.IsSpawned ) MessagePlayer("You need be spawned to use this command.", player );
    else if ( player.Vehicle ) MessagePlayer("You must be outside of the vehicle.", player );
    else if( !text ) MessagePlayer("Use /"+cmd+" <Veh/ID>", player);
    else if (!IsNum(text)) MessagePlayer("Use /"+cmd+" <Veh/ID>", player);
    else if (!FindVehicle(text.tointeger())) MessagePlayer("Vehicle ID does not exist.",player);
    else {
    local v=FindVehicle(text.tointeger());
    QuerySQL( db,"UPDATE Vehicles SET PX='"+player.Pos.x+"' WHERE ID='"+v.ID+"'");
    QuerySQL( db,"UPDATE Vehicles SET PY='"+player.Pos.y+"' WHERE ID='"+v.ID+"'");
    QuerySQL( db,"UPDATE Vehicles SET PZ='"+player.Pos.z+"' WHERE ID='"+v.ID+"'");
    QuerySQL( db,"UPDATE Vehicles SET Angle='"+player.Angle+"' WHERE ID='"+v.ID+"'");
v.SpawnPos = Vector( v.Pos.x, v.Pos.y, v.Pos.z );
    v.SpawnAngle = v.Angle;
    MessagePlayer( "Parked Vehicle!", player );
    MessagePlayer("You have changed car ID "+v.ID+" Position." , player );
        }
    }

KrlozZ...

Oh thank you :) i was finding a function for that, but that one was deleted :/.

thanks!

Xmair

Quote from: kennedyarz on Apr 27, 2017, 12:42 PMUse this method, so there will be no need to restart the server so that the vehicle appears where I put it

QuerySQL( db,"UPDATE Vehicles SET PX='"+player.Pos.x+"' WHERE ID='"+v.ID+"'");
QuerySQL( db,"UPDATE Vehicles SET PY='"+player.Pos.y+"' WHERE ID='"+v.ID+"'");
QuerySQL( db,"UPDATE Vehicles SET PZ='"+player.Pos.z+"' WHERE ID='"+v.ID+"'");
QuerySQL( db,"UPDATE Vehicles SET Angle='"+player.Angle+"' WHERE ID='"+v.ID+"'");
QuerySQL( db, "UPDATE Vehicles SET PX = '" + player.Pos.x + "', PY = '" + player.Pos.y + "', PZ = '" + player.Pos.z + "', Angle = '" + player.Angle + "' WHERE ID = " + v.ID );

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

kennedyarz

Quote from: Xmair on Apr 27, 2017, 04:20 PM
Quote from: kennedyarz on Apr 27, 2017, 12:42 PMUse this method, so there will be no need to restart the server so that the vehicle appears where I put it

QuerySQL( db,"UPDATE Vehicles SET PX='"+player.Pos.x+"' WHERE ID='"+v.ID+"'");
QuerySQL( db,"UPDATE Vehicles SET PY='"+player.Pos.y+"' WHERE ID='"+v.ID+"'");
QuerySQL( db,"UPDATE Vehicles SET PZ='"+player.Pos.z+"' WHERE ID='"+v.ID+"'");
QuerySQL( db,"UPDATE Vehicles SET Angle='"+player.Angle+"' WHERE ID='"+v.ID+"'");
QuerySQL( db, "UPDATE Vehicles SET PX = '" + player.Pos.x + "', PY = '" + player.Pos.y + "', PZ = '" + player.Pos.z + "', Angle = '" + player.Angle + "' WHERE ID = " + v.ID );

Not recommended as it confuses the newbie, it is better to do it separate and will see more if he has an error.

KAKAN

Quote from: kennedyarz on Apr 27, 2017, 06:06 PMNot recommended as it confuses the newbie, it is better to do it separate and will see more if he has an error.
local pPos = player.Pos;
local query = format("UPDATE Vehicles( PX, PY, PZ, Angle ) VALUES( %f, %f, %f, %f ) WHERE ID=%i",
 pPos.x,
 pPos.y,
 pPos.z,
 player.Angle,
 v.ID
);
QuerySQL( db, query );
Okay now?
oh no

Thijn

Quote from: KAKAN on Apr 28, 2017, 02:08 AM
Quote from: kennedyarz on Apr 27, 2017, 06:06 PMNot recommended as it confuses the newbie, it is better to do it separate and will see more if he has an error.
local pPos = player.Pos;
local query = format("UPDATE Vehicles( PX, PY, PZ, Angle ) VALUES( %f, %f, %f, %f ) WHERE ID=%i",
 pPos.x,
 pPos.y,
 pPos.z,
 player.Angle,
 v.ID
);
QuerySQL( db, query );
Okay now?
That is not a valid query.

Quote from: kennedyarz on Apr 27, 2017, 06:06 PM
Quote from: Xmair on Apr 27, 2017, 04:20 PM
Quote from: kennedyarz on Apr 27, 2017, 12:42 PMUse this method, so there will be no need to restart the server so that the vehicle appears where I put it

QuerySQL( db,"UPDATE Vehicles SET PX='"+player.Pos.x+"' WHERE ID='"+v.ID+"'");
QuerySQL( db,"UPDATE Vehicles SET PY='"+player.Pos.y+"' WHERE ID='"+v.ID+"'");
QuerySQL( db,"UPDATE Vehicles SET PZ='"+player.Pos.z+"' WHERE ID='"+v.ID+"'");
QuerySQL( db,"UPDATE Vehicles SET Angle='"+player.Angle+"' WHERE ID='"+v.ID+"'");
QuerySQL( db, "UPDATE Vehicles SET PX = '" + player.Pos.x + "', PY = '" + player.Pos.y + "', PZ = '" + player.Pos.z + "', Angle = '" + player.Angle + "' WHERE ID = " + v.ID );

Not recommended as it confuses the newbie, it is better to do it separate and will see more if he has an error.
And then they are confused because their server lags. Nah. It's better to teach them correctly, and just explain what's happening instead of learning them the wrong way.

kennedyarz


Mohamed Boubekri

I have test this and it Work
Keep up my friend.
| What now ? | Not yet ! |
Morrocan:- [ 🇲🇦 ].