Nos ennek a scriptnek csak client oldala van. itt van tessék.
addCommandHandler(\"fix\", function()
if getElementData(localPlayer, \"acc:admin\") >= 8 then
local respawnVehicleTBL = {}
local px, py, pz = getElementPosition(localPlayer)
local playerInt = getElementInterior(localPlayer)
local playerDim = getElementDimension(localPlayer)
local adminduty = getElementData(thePlayer, \"char:adminduty\")
for k, v in ipairs(getElementsByType(\"vehicle\", root, true)) do
if getElementInterior(v) == playerInt and getElementDimension(v) == playerDim then
local x, y, z = getElementPosition(v)
local distance = getDistanceBetweenPoints3D(x, y, z, px, py, pz)
local o = 0
if distance < 10 then
respawnVehicleTBL[#respawnVehicleTBL+1] = v
end
end
end
outputChatBox(\"[FIX] #FFFFFF\"..#respawnVehicleTBL..\" jármű megjavítva.\", 255, 50, 0, true)
if #respawnVehicleTBL > 0 then
triggerServerEvent(\"fixVehicles\", localPlayer, respawnVehicleTBL)
end
end
end)
Nos ennek a scriptnek csak client oldala van. itt van tessék.
addCommandHandler(\"fix\", function()
if getElementData(localPlayer, \"acc:admin\") >= 8 then
local respawnVehicleTBL = {}
local px, py, pz = getElementPosition(localPlayer)
local playerInt = getElementInterior(localPlayer)
local playerDim = getElementDimension(localPlayer)
local adminduty = getElementData(thePlayer, \"char:adminduty\")
for k, v in ipairs(getElementsByType(\"vehicle\", root, true)) do
if getElementInterior(v) == playerInt and getElementDimension(v) == playerDim then
local x, y, z = getElementPosition(v)
local distance = getDistanceBetweenPoints3D(x, y, z, px, py, pz)
local o = 0
if distance < 10 then
respawnVehicleTBL[#respawnVehicleTBL+1] = v
end
end
end
outputChatBox(\"[FIX] #FFFFFF\"..#respawnVehicleTBL..\" jármű megjavítva.\", 255, 50, 0, true)
if #respawnVehicleTBL > 0 then
triggerServerEvent(\"fixVehicles\", localPlayer, respawnVehicleTBL)
end
end
end)
Ha csak kliens oldali szkripted van, hogy a fenébe triggerelnél egy szerver oldali funkciót...
Szerver oldalon nincs létrehozva a fixVehicles event.
addEvent(\"fixVehicles\", true)
addEventHandler(\"fixVehicles\", root, function(tbl)
if tbl then
for key, veh in ipairs(tbl) do
fixVehicle(veh)
end
end
end)