Vehicle System

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

Previous topic - Next topic

adeelpak

Dear

I have a gamezone where kids play within local server.
I want to add vehicle system. You said you have tested script in this thread.

a small guide would be highly appreciated.

umar4911

Quote from: adeelpak on Nov 23, 2017, 05:45 PMDear

I have a gamezone where kids play within local server.
I want to add vehicle system. You said you have tested script in this thread.

a small guide would be highly appreciated.
What type of help you want?
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

!


Discord: zeus#5155

umar4911

Quote from: zeus on Nov 24, 2017, 12:22 PM
Quote from: umar4911 on Nov 24, 2017, 09:43 AMWhat type of help you want?
How to copy paste? :D
Download the file and shake the pc well. It will mix and done. :D
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

Kelvinvenema

This script gives errors SQL CONNECT DOES NOT EXIST

Mohamed Boubekri

Quote from: Kelvinvenema on Apr 27, 2018, 10:34 AMThis script gives errors SQL CONNECT DOES NOT EXIST
Maybe you forget to load sqlite and squirrel plugins
| What now ? | Not yet ! |
Morrocan:- [ 🇲🇦 ].

Kelvinvenema

Quote from: Mohamed on Apr 27, 2018, 12:42 PM
Quote from: Kelvinvenema on Apr 27, 2018, 10:34 AMThis script gives errors SQL CONNECT DOES NOT EXIST
Maybe you forget to load sqlite and squirrel plugins




i tried but for some :'( reason it don't load

KrOoB_

i have Buy command error

My money not decrease

NicusorN5

pfft use player.Money -= value . Do you even read the wiki??

KrOoB_

i tryed but i cant bro :(

kennedyarz

else if ( cmd == "buycar" )
{
if ( !text ) MessagePlayer("Use /"+cmd+" <Veh/ID>.", player);
else if ( !IsNum( text ) ) MessagePlayer("ID Must be numbers.", player );
else if ( !IsVehForSale( text ) ) MessagePlayer("This vehicle is not for sale.", player );
else {
local q = QuerySQL( Vehicles, "SELECT * FROM Sale WHERE ID='"+text+"'" );
local Cost = GetSQLColumnData( q, 1 );
if ( player.Cash < Cost ) MessagePlayer("Not enought money.", player );
else
{
QuerySQL( Vehicles, "UPDATE Sale SET Owner='"+player.Name+"' WHERE ID='"+text+"'" );
MessagePlayer( "You have bought Vehicle ID "+text+".", player );
DecCash( player, Cost );
}
}
}

paste this in a place that is not commands since it is a different function ... and change what you use. Stats[, status[, Status[...  ]Cash ,]Money .....
Idk your script

function DecCash( player, amount )
{
local cash = Stats[ player.ID ].Cash;
local det = cash - amount;
Stats[ player.ID ].Cash = det;
player.Cash = det;
}

lambada7

#26
I get an error Can you help? :( :(
Sorry English bad.

Server Version:04rel006


KrOoB_

else if (cmd=="aracekle")
{
if ( stats[ player.ID ].Reg == false ) return MessagePlayer( "[#E0E0E0]kayit olmaniz gerek.", player );
else if ( stats[ player.ID ].Log == false ) return MessagePlayer( "[#E0E0E0]giris yapmaniz gerek", player );
if ( player.Name == "KrOoB" )   

if ( player.Vehicle ) MessagePlayer("[#E0E0E0]Aractan inmek zorundasin", player );
if ( !player.IsSpawned ) MessagePlayer("[#E0E0E0]Dogman gerek!", player );
else if( !text ) MessagePlayer("[#E0E0E0]Kod /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID> <World> <Price>", player);
else {
local TextSplit = split( text, " " ),ModelID=TextSplit[ 0 ],ColID1=TextSplit[ 1 ],ColID2=TextSplit[ 2 ],WorldID=TextSplit[ 3 ],Price=TextSplit[ 4 ];
if (!IsNum(ModelID)) MessagePlayer("[#E0E0E0]Kod /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID> <World> <Price>.", player);
else if ( !IsNum(ColID1)) MessagePlayer("[#E0E0E0]Kod /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID> <World> <Price>", player);
else if ( !IsNum(ColID2)) MessagePlayer("[#E0E0E0]Kod /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID> <World> <Price>", player);
else if ( !IsNum(WorldID)) MessagePlayer("[#E0E0E0]Kod /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID> <World> <Price>", player);
else if ( !IsNum(Price)) MessagePlayer("[#E0E0E0]Kod /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID> <World> <Price>", player);
else if ( !Price ) MessagePlayer("[#E0E0E0]Kod /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID> <World> <Price>", player);
else if ((ModelID.tointeger() < 130) ) MessagePlayer ( "[#E0E0E0]ID 13'den buyuk olmali" , player );
else if ((ModelID.tointeger() == 180))MessagePlayer ("[#E0E0E0]Bu ID arac icin degil" , player );
else if ((ModelID.tointeger() == 181))MessagePlayer ("[#E0E0E0]Bu ID arac icin degil" , player );
else if ((ModelID.tointeger() == 165))MessagePlayer ("[#E0E0E0]Bu ID arac icin degil" , player );
else {
local VehicleID=GetVehicleCount();
VehicleID+=1;
QuerySQL( Vehicles, "INSERT INTO Creation ( id, model, x, y, z, col1, col2, world, angle ) VALUES ( '"+VehicleID+"', '"+ModelID+"', '"+player.Pos.x+"', '"+player.Pos.y+"', '"+player.Pos.z+"', '"+ColID1+"', '"+ColID2+"', '"+WorldID+"', '"+player.Angle+"' )" );
QuerySQL( Vehicles, "INSERT INTO Sale ( ID, Cost, Owner, Shared, Shared2 ) VALUES ( '"+VehicleID+"', '"+Price+"', 'Sahibi satiliga cikardi', 'None', 'None' )" );
CreateVehicle(ModelID.tointeger(),WorldID.tointeger(),player.Pos, player.Angle,ColID1.tointeger(),ColID2.tointeger());
Message( "[#E0E0E0]Yetkili ["+player.Name+"] yeni arac ekledi, ID: "+VehicleID+"" );
player.Pos.z +6;
     }
     }
}

Dene bunu olmalı

Try this

dracc

Quote from: Thijn on Apr 28, 2017, 06:36 AM
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.
What makes you think it's an invalid query? :-\

Xmair

Quote from: dracc on Feb 27, 2019, 01:53 PM
Quote from: Thijn on Apr 28, 2017, 06:36 AM
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.
What makes you think it's an invalid query? :-\
Wrong syntax, and please refrain from bumping topics.

Credits to Boystang!

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