Hi I’m just started on lua and i’m blocked , i wanted to get players position and value to put(save) on my DB. So if you got a hint or help and advice it can be helpful .
require "resources/essentialmode/lib/MySQL"
MySQL:open("localhost", "gta5_gamemode_essential", "root", "123soleil")
local function recuperePed()
local mypos={x,y,z}
mypos.x, mypos.y, mypos.z = GetPlayerPed(-1)
print("Valeur de x:"..mypos.x.." Valeur de y:"..mypos.y.."Valeur de z:"..mypos.z)
return mypos.x , mypos.y , mypos.z
end
local posx,posy,posz = recuperePed()
MySQL:executeQuery("UPDATE localisation tlo JOIN users tu ON tlo.IDlocalisation = tu.IDlocalisation SET posx='@posx', posy='@posy',posz'@posz' WHERE identifier='@identifier'",
{['@posx']= posx,['@posy']= posy,['@posz']= posz, ['@identifier']= identifier ]})
You can find my starting mld and mcd: