Sziasztok alapból van a zéróban egy gates resource akartam a szerelőknem kicsálni egy gatét de nem engedi \"gates/bms.lua:15: attempt to compare boolean with numbers\" ezt a hibakódot kaptam mi lehet a baj ? válaszokat előre is köszönöm!
local bmse = createObject(980, 1773.8, -1113.8, 21.6, 0, 0, 270)
exports.pool:allocateElement(bmse)
local bmsk = createObject(980, 1773.69995, -1130.19995,18.6, 0, 0, 270)
exports.pool:allocateElement(bmsk)
local open = false
local which = 0
-- Gate code
function bms(thePlayer)
local x, y, z = getElementPosition(thePlayer)
local distance1 = getDistanceBetweenPoints3D(1773.8,-1113.8, 21.6)
local distance2 = getDistanceBetweenPoints3D(1773.69995, -1130.19995,18.6)
if (distance1<=10) and (open==false) then
if (exports.global:hasItem(thePlayer, 145) or exports.global:hasItem(thePlayer, 82)) then
open = true
which = 1
outputChatBox(\"LSPD sorompó nyitva!\", thePlayer, 0, 255, 0)
moveObject(bmse, 1000,1773.8,-1113.8, 20.2, 0, 0, 270)
setTimer(bmsc, 5000, 1, thePlayer)
end
elseif (distance2<=10) and (open==false) then
if (exports.global:hasItem(thePlayer, 145)) then
open = true
which = 2
outputChatBox(\"LSPD Barrier is now Open!\", thePlayer, 0, 255, 0)
moveObject(bmsk, 1000, 1773.69995, -1130.19995, 17.3, 0, 0, 270)
setTimer(bmsc, 5000, 1, thePlayer)
end
end
end
addCommandHandler(\"gate\", bms)
function bmsc(thePlayer)
setTimer(resetState7, 1000, 1)
if (which==1) then
which = 0
moveObject(bmse, 1000, 1773.8, -1113.8, 21.6, 0, 0, 270)
elseif (which==2) then
which = 0
moveObject(bmsk, 1000, 1773.69995, -1130.19995,18.6, 0, 0, 270)
end
end
function resetState7()
open = false
end
ezt mutatja a 15.nek
if (distance1<=10) and (open==false) then
Hát én colShape-el oldanám meg, véleményem szerint sokkal egyszerűbb.
Létrehozás:
kapuelott = createColSphere ( float fX, float fY, float fZ, float fRadius )
Lekérdezés:
if (isElementWithinColShape(player, kapuelott)) then
Hát én colShape-el oldanám meg, véleményem szerint sokkal egyszerűbb.
Létrehozás:
kapuelott = createColSphere ( float fX, float fY, float fZ, float fRadius )
Lekérdezés:
if (isElementWithinColShape(player, kapuelott)) then
colsphape-el is kell megoldani, hiszen a getDistanceBetweenPoints3D-el oldalról is kitudja nyitni pl, és ha túl nagy a távolság, akkor egymásba is buggolnak a kapuk. :))
hali
local distance1 = getDistanceBetweenPoints3D(1773.8,-1113.8, 21.6)
local distance2 = getDistanceBetweenPoints3D(1773.69995, -1130.19995,18.6)
Nálad így van de a végén az x, y,z-t ott kell hagynod szóval
local distance1 = getDistanceBetweenPoints3D(1773.8,-1113.8, 21.6, x, y, z)
local distance2 = getDistanceBetweenPoints3D(1773.69995, -1130.19995,18.6, x, y, z)