SHOW:
|
|
- or go back to the newest paste.
1 | - | local hidden = { } |
1 | + | local hiding = false |
2 | ||
3 | - | function executeDimensionSwitch() |
3 | + | local function toggleObjects(show) |
4 | - | if #hidden > 0 then |
4 | + | |
5 | - | for i=1,#hidden do |
5 | + | for _, object in ipairs(objects) do |
6 | - | local object = hidden[i] |
6 | + | local id = getElementModel(object) |
7 | - | if isElement(object) then setElementDimension(object,0) end |
7 | + | if ids[id] then |
8 | setElementDimension(object, show and 0 or 1) | |
9 | - | --outputChatBox("#ff0000Objects have been shown",255,255,255,true) |
9 | + | end |
10 | - | hidden = { } |
10 | + | |
11 | - | else |
11 | + | |
12 | ||
13 | - | for i=1,#objects do |
13 | + | bindKey("N", "down", function () |
14 | - | local object = objects[i] |
14 | + | hiding = not hiding |
15 | - | local id = getElementModel(object) |
15 | + | |
16 | - | if ids[id] then |
16 | + | toggleObjects(hiding) |
17 | - | setElementDimension(object,1) |
17 | + | end) |
18 | - | table.insert(hidden,object) |
18 | + | |
19 | - | end |
19 | + | addEventHandler("onClientMapStarting", resourceRoot, function () |
20 | if hiding then | |
21 | - | --outputChatBox("#00ff00Objects have been hidden",255,255,255,true) |
21 | + | toggleObjects(false) |
22 | - | end |
22 | + | |
23 | end) |