« [0.4] Vote System
Vehicle System

adeelpak

  • Newbie
  • Posts: 9
Re: Vehicle System
« Reply #15, on November 23rd, 2017, 05:45 PM »
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

  • Sr. Member
  • Creating own server!
  • Posts: 475
Re: Vehicle System
« Reply #16, on November 24th, 2017, 09:43 AM »
Quote from adeelpak on November 23rd, 2017, 05:45 PM
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.
What type of help you want?
I am gamer, programmer and hacker. Try to find me!
xD

!

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

Discord: zeus#5155

umar4911

  • Sr. Member
  • Creating own server!
  • Posts: 475
I am gamer, programmer and hacker. Try to find me!
xD

Kelvinvenema

  • Newbie
  • Posts: 26
Re: Vehicle System
« Reply #19,  »
This script gives errors SQL CONNECT DOES NOT EXIST

Mohamed

  • Full Member
  • Regards, We3da
  • Posts: 247
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

Kelvinvenema

  • Newbie
  • Posts: 26

KrooB

  • Full Member
  • BEN TÜRKÜM
  • Posts: 118
Re: Vehicle System
« Reply #22,  »
i have Buy command error

My money not decrease
We are his people !
Who can challange us ?

Athanatos

  • Hero Member
  • Romania Cops N Robbers Lead Developer
  • Posts: 816
Re: Vehicle System
« Reply #23,  »
pfft use player.Money -= value . Do you even read the wiki??

KrooB

  • Full Member
  • BEN TÜRKÜM
  • Posts: 118
Re: Vehicle System
« Reply #24,  »
i tryed but i cant bro :(
We are his people !
Who can challange us ?

kennedyarz

  • Sr. Member
  • Making American Great Again
  • Posts: 334
Re: Vehicle System
« Reply #25,  »
Code: [Select]
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

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

lambada7

  • Newbie
  • Posts: 7
Re: Vehicle System
« Reply #26,  »Last edited
I get an error Can you help? :( :(
Sorry English bad.

Server Version:04rel006


KrooB

  • Full Member
  • BEN TÜRKÜM
  • Posts: 118
Re: Vehicle System
« Reply #27,  »
Code: [Select]
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
We are his people !
Who can challange us ?

dracc

  • Jr. Member
  • Posts: 84
Re: Vehicle System
« Reply #28,  »
Quote from Thijn 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.
What makes you think it's an invalid query? :-\

Xmair

  • Wiki Contributor
  • Posts: 881
Re: Vehicle System
« Reply #29,  »
Quote from dracc on February 27th, 01:53 PM
Quote from Thijn 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.
What makes you think it's an invalid query? :-\
Wrong syntax, and please refrain from bumping topics.
VU Full Member | VCCNR Developer | KTB Developer | EAD Ex-Scripter

« [0.4] Vote System