In that case, if you use my code, and put it at the very bottom of the script, it should work flawlessly
Hey, it’s not working it says that command doesn’t exist.
If you’re using my code it should be /givecar ID PLATE
Else its /transfervehicle ID PLATE
Please notice if the plate is ABC 123 it has to be written exactly so, including whitespaces
/transfervehicle ID ABC 123
Or if you use my code
/givecar ID ABC 123
How would i make it where only the car dealer can use this command. And you dont have to own it to transfer the vehicle
I cant seem to find the server.lua can someone help me with that?
Its Main.lua in server file
where to exactly put it ? i dont have server.lua
I already did as u told, i can see the command and i write command like /transfervehicle 2 YUS 120 as i see in mysql plate. But prints This vehicle plate does not exist or the plate was incorrectly written. car is my steam id at sql owner table
atilano
October 23, 2019, 4:23pm
51
Is there a way to put a money transfer in this script?
For example: /transfervehicle [id] [plate] [value]
Thanks in advance
3Bot
November 24, 2019, 6:37pm
52
Why put money? Let the players pay each other as there is already a function for that in esx.
Nevos
November 29, 2019, 6:16pm
53
How to write that into an ESX Menu?
3Bot:
RegisterCommand(‘transfervehicle’, function(source, args) myself = source other = args[1] if(GetPlayerName(tonumber(args[1])))then else TriggerClientEvent(‘chatMessage’, source, “SYSTEM”, {255, 0, 0}, “Incorrect player ID!”) return end local plate1 = args[2] local plate2 = args[3] local plate3 = args[4] local plate4 = args[5] if plate1 ~= nil then plate01 = plate1 else plate01 = “” end if plate2 ~= nil then plate02 = plate2 else plate02 = “” end if plate3 ~= nil then plate03 = plate3 else plate03 = “” end if plate4 ~= nil then plate04 = plate4 else plate04 = “” end local plate = (plate01 … " " … plate02 … " " … plate03 … " " … plate04) mySteamID = GetPlayerIdentifiers(source) mySteam = mySteamID[1] myID = ESX.GetPlayerFromId(source).identifier myName = ESX.GetPlayerFromId(source).name targetSteamID = GetPlayerIdentifiers(args[1]) targetSteamName = ESX.GetPlayerFromId(args[1]).name targetSteam = targetSteamID[1] MySQL.Async.fetchAll( ‘SELECT * FROM owned_vehicles WHERE plate = @plate ’, { [’@plate ’] = plate }, function(result) if result[1] ~= nil then local playerName = ESX.GetPlayerFromIdentifier(result[1].owner).identifier local pName = ESX.GetPlayerFromIdentifier(result[1].owner).name CarOwner = playerName print("Car Transfer “, myID, CarOwner) if myID == CarOwner then print(“Transfered”) data = {} TriggerClientEvent(‘chatMessage’, other, “^4Vehicle with the plate ^^1" … plate … "^r^4was transfered to you by: ^ ^2” … myName) MySQL.Sync.execute(“UPDATE owned_vehicles SET owner=@owner WHERE plate=@plate”, {[’@owner ’] = targetSteam, [’@plate ’] = plate}) TriggerClientEvent(‘chatMessage’, source, “^4You have ^^3transfered^0^4 your vehicle with the plate ^ ^1” … plate … “” ^r^4to ^^2"… targetSteamName) else print(“Did not transfer”) TriggerClientEvent(‘chatMessage’, source, "^ ^1You do not own the vehicle”) end else TriggerClientEvent(‘chatMessage’, source, “^1^*ERROR: ^r^0This vehicle plate does not exist or the plate was incorrectly written.”) end end ) end)
when i paste that ingame its telling me that command is not valide
i dont have server.lua in vehicleshop what i need to do
If ive duplicated the vehicleshop for another dealer, should I need this in both scripts or is it only pulling from the soldcars database?
Also, is there an easy way to set this to not use SteamID but to instead use License#?
1 Like
3Bot
January 30, 2020, 2:52am
57
You don’t need to add this in the second script, as I assume everything stays the same, except for a new vehicle buy list for the new dealership.
Nah, everything was changed so it’s an entirely new society. It still uses the Vehicles_sold table though.
RadoBG
March 30, 2020, 11:10pm
60
Does someone got it working on the new es_extended?