Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 25th, 2012  |  syntax: Lua  |  size: 0.89 KB  |  hits: 29  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. function loadVehicles (playerSource)
  2. local source = playerSource
  3. local playerID = exports.server:playerID( source )
  4. local getAllVehicles = exports.DENmysql:query( "SELECT * FROM vehicles WHERE ownerid = '" .. playerID .. "'" )
  5.         if getAllVehicles and #getAllVehicles > 0 then
  6.                 -- Insert all vehicles in the grid and open the gui
  7.                 triggerClientEvent(source, "insertVehicles", source, getAllVehicles)   
  8.         end
  9.         triggerClientEvent(source, "showVehiclesGUI", source)
  10. end
  11. addCommandHandler("vehicles", loadVehicles)
  12.  
  13. function spawnVehicle (vehicleID)
  14. local getVehicle = exports.DENmysql:querySingle( "SELECT * FROM vehicles WHERE uniqueid = '" .. tonumber(vehicleID) .. "'" )
  15.         if getVehicle then
  16.         createVehicle ( getVehicle.vehicleid, getVehicle.x, getVehicle.y, getVehicle.z, 0, 0, getVehicle.rotation )
  17.         end
  18. end
  19. addEvent("spawnVehicle", true)
  20. addEventHandler("spawnVehicle", root, spawnVehicle )