Szerző Téma: Kapu System Hiba [GATE SYSTEM ERROR]  (Megtekintve 1268 alkalommal)

Kapu System Hiba [GATE SYSTEM ERROR]
« Dátum: 2017. Február 08. - 00:52:23 »
0
Sziasztok Kedves Fórumozók, Fejlesztők, Mapperek, Spricterek és további emberek. Lenne egy problémám egy mta_gate nevezetű sprict-el megmutatom a sprict-et de előbb itt van egy két kép hogy mi is lenne a problémám, remélem tudtok segíteni nagyon hálás lennék érte.
 
KÉP:
 
\"kep.png\"
 
 
 
COD:
 
Lua
 

local connection = exports.mta_connection:getConnection()
function loadAllGate()
gates = {}
local queryHandler = dbQuery(connection, \"SELECT * FROM gates\")
local result, numAffectedRows, errorMsg = dbPoll(queryHandler, -1)
if numAffectedRows > 0 then
   for key, row in ipairs(result) do
      local gateId = tonumber(row[\"id\"])
      gates[key] = {}
      gates[key][\"sqlId\"] = gateId
      gates[key][\"modelId\"] = tonumber(row[\"modelId\"])
      gates[key][\"lockState\"] = true
      gates[key][\"defaultState\"] = fromJSON(row[\"defaultState\"])
      gates[key][\"changeState\"] = fromJSON(row[\"changeState\"])
      gates[key][\"createRotation\"] = fromJSON(row[\"createRotation\"])
      gates[key][\"IndDim\"] = fromJSON(row[\"IndDim\"])
 
      gates[key][\"gate\"] = createObject(gates[key][\"modelId\"], gates[key][\"defaultState\"][1], gates[key][\"defaultState\"][2], gates[key][\"defaultState\"][3], gates[key][\"defaultState\"][4], gates[key][\"defaultState\"][5], gates[key][\"defaultState\"][6])
      setElementRotation(gates[key][\"gate\"], gates[key][\"createRotation\"][1], gates[key][\"createRotation\"][2], gates[key][\"createRotation\"][3])
      setElementInterior(gates[key][\"gate\"], gates[key][\"IndDim\"][1])
      setElementDimension(gates[key][\"gate\"], gates[key][\"IndDim\"][2])
   end
end
outputDebugString(#gates .. \" gate(s) loaded\")
end
addEventHandler(\"onResourceStart\", resourceRoot, loadAllGate)
addCommandHandler(\"creategate\", function (player, cmd, modellID, changex, changey, changez)
if player then
   if modellID and changex and changey and changez then
      if getElementData(player, \"acc:admin\") >= 8 then
         local x, y, z = getElementPosition(player)
         local rotx, roty, rotz = getElementRotation(player)
         local int = getElementInterior(player)
         local dim = getElementDimension(player)
         dbExec(connection, \"INSERT INTO gates SET defaultState = ?, createRotation = ?, changeState = ?, modelId = ?, IndDim = ? \", toJSON({x, y, z}), toJSON({rotx, roty, rotz}), toJSON({tonumber(changex), tonumber(changey), tonumber(changez)}), modellID, toJSON({int, dim}))
         outputChatBox(\"#19B5FE\'Sikeres\' #ffffff Létrehozás\", player, 255, 255, 255, true)
      end
   else
      outputChatBox(\"#19B5FE[Használat] #ffffff/\".. cmd ..\" #00ced1[Modell ID] [Mozgás_X] [Mozgás_Y] [Mozgás_Z]\", player, 255, 255, 255, true)
   end
end
end)
addCommandHandler(\"gate\", function(player)
local gate = getClosestGate(player)
if gate then
   if (not exports[\"mta_item\"]:hasItemS(player, 36, tonumber(gate)) or false) and getElementData(player, \"acc:admin\") <= 5 then
      outputChatBox(\"#dc143c[Hiba]:#ffffff Nincs kulcsod a kapuhoz.\", player, 255, 255, 255, true)
      return
   end

   if getElementData(gates[gate][\"gate\"], \"inUse\") then
      return
   end
   setElementData(gates[gate][\"gate\"], \"inUse\", true)
   if gates[gate][\"lockState\"] then
      moveObject(gates[gate][\"gate\"], 1500, gates[gate][\"changeState\"][1], gates[gate][\"changeState\"][2], gates[gate][\"changeState\"][3], gates[gate][\"changeState\"][4], gates[gate][\"changeState\"][5], gates[gate][\"changeState\"][6], \"OutQuad\")
      setElementInterior(gates[gate][\"gate\"], gates[gate][\"IndDim\"][1])
      setElementDimension(gates[gate][\"gate\"], gates[gate][\"IndDim\"][2])
   else
      moveObject(gates[gate][\"gate\"], 1500, gates[gate][\"defaultState\"][1], gates[gate][\"defaultState\"][2], gates[gate][\"defaultState\"][3], gates[gate][\"defaultState\"][4], gates[gate][\"defaultState\"][5], gates[gate][\"defaultState\"][6], \"OutQuad\")
      setElementInterior(gates[gate][\"gate\"], gates[gate][\"IndDim\"][1])
      setElementDimension(gates[gate][\"gate\"], gates[gate][\"IndDim\"][2])
   end
   
   gates[gate][\"lockState\"] = not gates[gate][\"lockState\"]
   setTimer(function()
      setElementData(gates[gate][\"gate\"], \"inUse\", false)
   end, 1500, 1)
end
end)
addCommandHandler(\"nearbygate\", function(player)
local gate = getClosestGate(player)
if gate then
   outputChatBox(\"#19B5FE[SERVER NÉV] #ffffffLegközelebbi kapu: #19B5FE\"..gate, player, 0, 0, 0, true)
else
   outputChatBox(\"#19B5FE[SERVER NÉV] #ffffffNincs a közeledben kapu.\", player, 0, 0, 0, true)      
end
end)
function getClosestGate(p1)
local x, y, z = getElementPosition(p1)
local dis = 99999
local dis2 = 0
local gate = false
for key, value in ipairs(gates) do
   local x2, y2, z2 = getElementPosition(gates[key][\"gate\"])
   dis2 = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2)
      
   if tonumber(dis2) < tonumber(dis) and tonumber(dis2) <= 9 then
      dis = dis2
      gate = key
   end
end
return gate
end

 
meta:
 

<meta>
    <script src=\"server.lua\" />
</meta>

 
 

Kapu System Hiba [GATE SYSTEM ERROR]
« Válasz #1 Dátum: 2017. Február 08. - 17:05:16 »
0
Meta-ban a script-hez kell egy type, nem?

Kapu System Hiba [GATE SYSTEM ERROR]
« Válasz #2 Dátum: 2017. Február 08. - 17:24:57 »
0
Szerver-oldal esetén nem szükséges.

Kapu System Hiba [GATE SYSTEM ERROR]
« Válasz #3 Dátum: 2017. Február 08. - 18:33:07 »
0
megpróbáloma  typet de hogyan írjam segítenétek

Kapu System Hiba [GATE SYSTEM ERROR]
« Válasz #4 Dátum: 2017. Február 13. - 15:34:15 »
0
nem jó Type se valami más ötlet hogy lehetne megoldani

Kapu System Hiba [GATE SYSTEM ERROR]
« Válasz #5 Dátum: 2017. Február 13. - 21:30:07 »
0
hiányzik az sql tábla i think

Kapu System Hiba [GATE SYSTEM ERROR]
« Válasz #6 Dátum: 2017. Február 21. - 16:58:15 »
0
fáradt external :D, ha sikeresen létre hoztad akkor egy /restart mta_gates és elvileg jónak kell lennie
 
Ha mégse jo, akkor rosszul rakod le :)

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal