Szerző Téma: MTA:RP  (Megtekintve 850 alkalommal)

MTA:RP
« Dátum: 2016. Március 06. - 18:46:17 »
0
Sziasztok szeretnék segítséget kérni. Az lenne hogy van egy gate-system-em és be írogattam a kordinátákat lásd:
local objGateg = createObject(980, 1418.9699707031, -1841.4000244141, 15.300000190735, 0, 0, 270) --elso macska
local open = false -- lokális macska
function usePDFrontGarageGate(thePlayer)
local x, y, z = getElementPosition(thePlayer)
local distance = getDistanceBetweenPoints3D(1418.9699707031, -1841.4000244141, 15.300000190735, x, y, z) --3d geci
if (distance<=10) and (open==false) then
   local theTeam = getPlayerTeam(thePlayer)
        local factionID = getElementData ( thePlayer, \"faction\" )
      if ( factionID == 24 ) or (exports.global:isPlayerAdmin(thePlayer)) then
      open = true
      outputChatBox(\"Kapu nyitva!\", thePlayer, 0, 255, 0)
      moveObject(objGateg, 980, 1418.9699707031, -1848.0999755859, 15.300000190735, 0, 0, 0) --mozgato macska
      setTimer(closePDFrontGarageGate, 5000, 1, thePlayer)
      else
      outputChatBox(\"Nem vagy önkormányzatban!\", thePlayer, 255, 0, 0) --ha nem macska
   end
end
end
addCommandHandler(\"gate\", usePDFrontGarageGate)
addCommandHandler(\"kapu\", usePDFrontGarageGate) --szeretem a magyar nokedlit :)
function closePDFrontGarageGate(thePlayer)
setTimer(resetState8, 1000, 1)
moveObject(objGateg, 980, 1418.9699707031, -1841.4000244141, 15.300000190735, 0, 0, 0) -- elso macska
end
function resetState8()
open = false
end
És a ki nyitás működik,de a becsukás már nem. Mi lenne a hiba? előre is köszönöm a választ. :)

MTA:RP
« Válasz #1 Dátum: 2016. Március 06. - 22:12:12 »
0
Tessék.
 
local pos = {1418.9699707031, -1841.4000244141, 15.300000190735}
local objGateg = createObject(980, pos[1], pos[2], pos[3], 0, 0, 270)
 
local open = false
function usePDFrontGarageGate(playerSource)
   local x, y, z = getElementPosition(playerSource)
   local distance = getDistanceBetweenPoints3D(pos[1], pos[2], pos[3], x, y, z)
     
   if (distance<=10) and (open==false) then
        local factionID = getElementData ( playerSource, \"faction\" ) or 24
        if ( factionID == 24 ) or (exports.global:isPlayerAdmin(playerSource) ) then
           open = true
           outputChatBox(\"Kapu nyitva!\", playerSource, 0, 255, 0)
   moveObject(objGateg, 980, pos[1], pos[2], pos[3]-4, 0, 0, 0)
   setTimer(function()
      moveObject(objGateg, 980, pos[1], pos[2], pos[3], 0, 0, 0)
      setTimer(function()
         open = false
      end, 1000, 1)
   end, 5000, 1)
        else
           outputChatBox(\"Nem vagy önkormányzatban!\", playerSource, 255, 0, 0)
        end
    end
end
addCommandHandler(\"gate\", usePDFrontGarageGate)
addCommandHandler(\"kapu\", usePDFrontGarageGate)

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal