#ps-mdt qbx_properties

1 messages · Page 1 of 1 (latest)

mild ivy
#

is this the correct way to get players properties for ps-mdt

function GetPlayerProperties(cid, cb)
local result = MySQL.query.await('SELECT property_type AS label, address AS coords FROM qbx_properties WHERE character_id = ?', {cid})
return result

end

rotund shadow
#

aint that a database error

mild ivy
#

yeah found a fix for it

tired horizon
mild ivy
storm tapir
#

What was the fix? I am having the same issue.

mild ivy
#

try searching the ps discord

spring tartan
#

Did you ever find the snippet for this? Can't find it myself, but not sure if I'm just stupid

mild ivy
#

**find this line in ps-mdt/dbm.lua function GetPlayerProperties(cid, cb) replace it with **

function GetPlayerProperties(cid, cb)
local result = MySQL.query.await('SELECT houselocations.label, houselocations.coords FROM player_houses INNER JOIN houselocations ON player_houses.house = houselocations.name where player_houses.citizenid = ?', {cid})
return result
end

**next find this line function GetPlayerApartment replace it with **

function GetPlayerApartment(cid, cb)
local result = MySQL.query.await('SELECT name, type, label FROM apartments where citizenid = ?', {cid})
return result
end

**next go to ps-mdt/server/main.lua go to line 532 and replace 532-547 with **

local Houses = {}
local properties= GetPlayerProperties(person.cid)
for k, v in pairs(properties) do
Coords[#Coords+1] = {
coords = json.decode(v["coords"]),
}
end
for index = 1, #Coords, 1 do
Houses[#Houses+1] = {
label = properties[index]["label"],
coords = tostring(Coords[index]["coords"]["enter"]["x"]..",".. Coords[index]["coords"]["enter"]["y"].. ",".. Coords[index]["coords"]["enter"]["z"]),
}
end
person.properties = Houses
end
end

tired horizon
mild ivy
#

qb apartments im pretty sure

#

dont use ps-housing

#

sorry

Config.UsingPsHousing = false
Config.UsingDefaultQBApartments = false
Config.OnlyShowOnDuty = true

tired horizon
#

I entered the snippet you sent and it failed to load a profile with a fault saying player doesn't own an apartment

tired horizon
#

Have it set that way

tired horizon
mild ivy
#

interesting , assuming you are using qbx_properties ?

spring tartan
#

Yeah I entered the snippet and I'm getting this error:

#

Although it would make sense because I don't have those tables, it's all handled inside the properties table so

tall portal
#

im currently up against the same issue, were you able to fix this?