Guten Tag,
Ich mache mich gerade an OOP ran und versuche ein Haus-System zu erstellen.
Wobei ich gerade am tüffteln bin, ist das herausfinden des Interiors welcher dem Haus gehört welches ich gerade betreten habe.
Ich denke gerade daran eine element-data auf das Haus zu setzen , jedoch weiß ich nicht wie ich das anstelle.
Mein Code:
Lua
House = { }
House_mt = { __index = House }
activeHouses = {}
local defaultSettings = {
price = 25000,
interior = 3,
}
function House:constructor( hx, hy, hz, interior, price )
local info = {}
if hx and hy and hz then
setmetatable(info,House_mt)
info.coordx = tonumber(hx)
info.coordy = tonumber(hy)
info.coordz = tonumber(hz)
info.price = tonumber(price) or defaultSettings.price
info.interior = tonumber(interior) or defaultSettings.interior
outputChatBox(info.coordx)
outputChatBox(info.coordy)
outputChatBox(info.coordz)
info.pickup = createPickup(info.coordx,info.coordy,info.coordz,3,1273,0,-1)
activeHouses[info] = true
end
end
addEventHandler("onPickupHit",root,
function(plr)
for k,v in pairs(activeHouses) do
if source == k.pickup then
triggerClientEvent("ShowHouseGUI",plr)
end
end
end
)
Alles anzeigen
MfG,