Hello Friends I wrote an Invisible object script.
But invisible objects are not visible, there is no function.
https://www.imageupload.net/image/Lz6wb
Gamemode : [DM] Race
local invisibles = {}
local enabled = true
local airport = {
8171, 8172, 8355, 8356, 8357, 3458, 8838, 8558, 8557
}
function onMapStarted()
invisibles = {}
setTimer(getInvisibleObjects, 2000, 1)
end
addEventHandler("onClientMapStarting", getRootElement(),onMapStarted)
function getInvisibleObjects()
for i, o in ipairs(getElementsByType("object")) do
if(getObjectScale(o) == 0 or getElementAlpha(o) == 0)then
table.insert(invisibles, o)
else
local oid = getElementModel(o)
for k, id in ipairs(airport)do
if(oid == id)then
table.insert(invisibles, o)
end
end
end
end
update()
end
bindKey("f10", "up", function()
--if not getElementData(localPlayer,"login") then return end
enabled = not enabled
if(enabled)then
create("Invisible Objects are now","visible", 0, 255, 0)
else
create("Invisible Objects are now","invisible", 255, 0, 0)
end
update()
end
)
function update()
if(enabled)then
for i, o in ipairs(invisibles)do
setObjectScale(o, 1)
setElementAlpha(o, 255)
setElementDoubleSided(o, true)
end
else
for i, o in ipairs(invisibles)do
setObjectScale(o, 0)
setElementAlpha(o, 0)
setElementDoubleSided(o, false)
end
end
end