Jump to content

DerekSP

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by DerekSP

  1. Hello. I have been following a youtube tutorial about MTA coding, and I got to the point where I want to set up a database of parked cars. I have a /park command that is supposed to write the position and direction of the vehicle a player is in to "vehicles" table in global.db Here's the code: function parkVehicle(player, command, model) local playerVehicle = getPedOccupiedVehicle(player) local db = exports.db:getConnection() if playerVehicle then local x, y, z = getElementPosition(playerVehicle) local d, e, f = getElementRotation(playerVehicle) dbExec(db, 'INSERT INTO vehicles (model, x, y, z, d) VALUES (?, ?, ?, ?, ?)', model, x, y, z, d) outputChatBox("Vehicle parked") else outputChatBox("You are not in a vehicle") end end addCommandHandler('park', parkVehicle, false, false) The youtube tutorial had this done automatically upon spawning of the vehicle, but I wanted to split it into two commands, but seems like I failed somewhere. Please, I need any help. I have been checking the code, comparing it to the tutorial, and everything seems like it should work just fine...
×
×
  • Create New...