« [0.4] Vote System
Vehicle System

KrlozZ...

  • Jr. Member
  • Just me, Just me, Just me!
  • Posts: 53
Vehicle System
« on April 26th, 2017, 10:58 PM »Last edited on April 27th, 2017, 08:22 AM
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

  • Full Member
  • Posts: 144
Strength does not come from wining.Your struggles develop your strengths.

!

  • Sr. Member
  • Don't feel shy while zooming on h*r... >>zeus#5155
  • Posts: 380

Discord: zeus#5155

KrlozZ...

  • Jr. Member
  • Just me, Just me, Just me!
  • Posts: 53

!

  • Sr. Member
  • Don't feel shy while zooming on h*r... >>zeus#5155
  • Posts: 380

Discord: zeus#5155

KrlozZ...

  • Jr. Member
  • Just me, Just me, Just me!
  • Posts: 53

Zone_Killer

  • Jr. Member
  • K.D.M No.1
  • Posts: 99
Bohemia Is God Of Punjabi Rap
Yo Yo Honey Singh tou chutiya hai

kennedyarz

  • Sr. Member
  • Making American Great Again
  • Posts: 334
Re: Vehicle System
« Reply #7, on April 27th, 2017, 01:42 PM »
Use this method, so there will be no need to restart the server so that the vehicle appears where I put it

Code: [Select]
    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...

  • Jr. Member
  • Just me, Just me, Just me!
  • Posts: 53
Re: Vehicle System
« Reply #8, on April 27th, 2017, 01:51 PM »
Oh thank you :) i was finding a function for that, but that one was deleted :/.

thanks!

Xmair

  • Wiki Contributor
  • Posts: 874
Re: Vehicle System
« Reply #9, on April 27th, 2017, 05:20 PM »
Quote from kennedyarz on April 27th, 2017, 01:42 PM
Use this method, so there will be no need to restart the server so that the vehicle appears where I put it

Code: [Select]
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+"'");
Code: [Select]
QuerySQL( db, "UPDATE Vehicles SET PX = '" + player.Pos.x + "', PY = '" + player.Pos.y + "', PZ = '" + player.Pos.z + "', Angle = '" + player.Angle + "' WHERE ID = " + v.ID );
VU Full Member | VCCNR Developer | KTB Developer | EAD Ex-Scripter

kennedyarz

  • Sr. Member
  • Making American Great Again
  • Posts: 334
Re: Vehicle System
« Reply #10, on April 27th, 2017, 07:06 PM »
Quote from Xmair on April 27th, 2017, 05:20 PM
Quote from kennedyarz on April 27th, 2017, 01:42 PM
Use this method, so there will be no need to restart the server so that the vehicle appears where I put it

Code: [Select]
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+"'");
Code: [Select]
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

  • Wiki Contributor
  • Posts: 3,346
Re: Vehicle System
« Reply #11, on April 28th, 2017, 03:08 AM »
Quote from kennedyarz on April 27th, 2017, 07:06 PM
Not recommended as it confuses the newbie, it is better to do it separate and will see more if he has an error.
Code: [Select]
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?
You can contact me using Discord, at Developers.CPP( check off-board to find the invite link )
Github: https://github.com/theKAKAN

Thijn

  • VC:MP Beta Tester
  • Posts: 1,689
Re: Vehicle System
« Reply #12, on April 28th, 2017, 07:36 AM »
Quote from KAKAN on April 28th, 2017, 03:08 AM
Quote from kennedyarz on April 27th, 2017, 07:06 PM
Not recommended as it confuses the newbie, it is better to do it separate and will see more if he has an error.
Code: [Select]
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 April 27th, 2017, 07:06 PM
Quote from Xmair on April 27th, 2017, 05:20 PM
Quote from kennedyarz on April 27th, 2017, 01:42 PM
Use this method, so there will be no need to restart the server so that the vehicle appears where I put it

Code: [Select]
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+"'");
Code: [Select]
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

  • Sr. Member
  • Making American Great Again
  • Posts: 334

Mohamed

  • Full Member
  • Regards, We3da
  • Posts: 247
Re: Vehicle System
« Reply #14,  »
I have test this and it Work
Keep up my friend.
Feel Free To PM Me For Any Support, I'm Care.
Anyway u can Contact Me Ingame!
Ingame Name: [AFt]We3da^
My Own Server: ViceEvil Server

« [0.4] Vote System