Ich hab ein kleines Problem bei meiner ID Abfrage. Ich will durch die ID
den Interior, X, Y, Z Koordinate herausfinden, jedoch kommt immer in
der ChatBox Diese ID ist nicht vergeben. Vielleicht könnt Ihr mir
helfen.
Lua
function createHaus(thePlayer,cmd,ID,preis)
if tonumber(getElementData(thePlayer,"adminlevel")) >=3 then
if (intid[tonumber(ID)]) then
if tonumber(preis) > 10000 and tonumber(preis) < 10000000 then
x, y, z = getElementPosition(thePlayer)
local intstring = intid[tonumber(ID)]
local int = gettok( intstring,1,string.byte('|'))
local ix = gettok( intstring,2,string.byte('|'))
local iy = gettok( intstring,3,string.byte('|'))
local iz = gettok( intstring,4,string.byte('|'))
local preis = tonumber(preis)
local besitzer = "keiner"
local lock = 0
local hresult = mysql_query(handler,"INSERT INTO hausdata ( Int, X,
Y, Z, PX, PY, PZ, Besitzer, Preis, Lockstate)
VALUES('"..tonumber(int).."', '"..x.."', '"..y.."', '"..z.."',
'"..ix.."', '"..iy.."', '"..iz.."', '"..besitzer.."', '"..preis.."',
'"..lock.."');")
createHaus()
outputChatBox("Das Haus wurde erstell!", thePlayer, 0, 255, 0)
else
outputChatBox("Der Betrag muss zwischen 10000 und 10000000 liegen!", thePlayer, 0, 255, 0)
end
else
outputChatBox("Dieser Interior ist nicht vergeben! Versuche einen anderen!", thePlayer, 0, 255, 0)
end
elseif tonumber(getElementData(thePlayer,"adminlevel"))>0 and tonumber(getElementData(thePlayer,"adminlevel"))<3 then
outputChatBox("Dein Adminlevel ist nicht hoch genug!", thePlayer, 0, 255, 0)
end
end
addCommandHandler("createhaus", createHaus)
Alles anzeigen
Hier ein Ausschnit der INT
Lua
intid = {
[28]="17|-25.884498|-185.868988|1003.546875",
[29]="2|271.884979|306.631988|999.148437"
}
oder wäre es besser das ganze mit einer for-Schleife zu lösen?
mfg