Moin,
Wie kann ich Info aus dem DB rausholen?
Sagen wir ich hab in Db Spalte 1 = X,y,z Korrdinate, und Splate 2=steht Autopreis
wie kann ich rausfinden in welche Marker er ist? und wie bekomm ich den infomatison raus?
Lua
function autospawner()
function queryCallback(query)
result = dbPoll(query,0)
if result then
for _, row in pairs(result) do
outputChatBox("ja")
outputChatBox(row["CarID"])
outputChatBox(row["spawn"])
createVehicle(tonumber(row["CarID"]), unpack(fromJSON(row["spawn"])))
x,y,z = unpack(fromJSON(row["marker"]))
marker = createMarker (x,y,z, "cylinder", 1.5, 255, 255, 0, 170 )
end
end
end
dbQuery(queryCallback, MySQLConnection,"SELECT * FROM autohaus")
end
addEventHandler ( "onResourceStart", getRootElement(), autospawner )
function markerAlert(markerHit,matchingDimension)
local facker = dbQuery(MySQLConnection,"SELECT * FROM autohaus WHERE `marker` = '"..fromJSON(row["spawn"])"'")
if facker then
outputChatBox(fromJSON(row["spawn"]))
local carname = row["carname"]
local preis = row["preis"]
outputChatBox(preis)
else
outputChatBox("fail")
end
end
addEventHandler("onPlayerMarkerHit",getRootElement(),markerAlert)
Alles anzeigen
Mar