2DWorlds Forums
Anyone want to add a VIP door - Printable Version

+- 2DWorlds Forums (http://2dworlds.buildism.net/forum)
+-- Forum: 2DWorlds (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=4)
+--- Forum: Scripting (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=13)
+--- Thread: Anyone want to add a VIP door (/showthread.php?tid=1133)



Anyone want to add a VIP door - BuildistGuard - 01-15-2011

It only lets certain users in the door, any other players would just be killed.


RE: Anyone want to add a VIP door - Jacob__mybb_import1 - 01-15-2011

Try this script:
Quote:allowed = {"YourNameHere", "OtherNameHere"}

function in_table ( e, t )
for _,v in pairs(t) do
if (v==e) then return true end
end
return false
end

function onCollide(part)
if part.Parent:isA("Character") then
local name = part.Parent.Name
if in_table(name, allowed) then
if script.Parent.Collidable then
script.Parent.Collidable = false
script.Parent.Transparency = 0.5
sleep(1)
script.Parent.Collidable = true
script.Parent.Transparency = 0
end
end
end
end

link(script.Parent.Collided, onCollide)

It doesn't kill, but that would be easy to add if you wanted to.


RE: Anyone want to add a VIP door - Paradox - 01-15-2011

(01-15-2011, 05:37 PM)Jacob_ Wrote: Try this script:
Quote:allowed = {"YourNameHere", "OtherNameHere"}

function in_table ( e, t )
for _,v in pairs(t) do
if (v==e) then return true end
end
return false
end

function onCollide(part)
if part.Parent:isA("Character") then
local name = part.Parent.Name
if in_table(name, allowed) then
if script.Parent.Collidable then
script.Parent.Collidable = false
script.Parent.Transparency = 0.5
sleep(1)
script.Parent.Collidable = true
script.Parent.Transparency = 0
end
end
end
end

link(script.Parent.Collided, onCollide)

It doesn't kill, but that would be easy to add if you wanted to.

Make it so it doesn't kill when closed and only kills wen opened.
And can you make it so you need an admin shirt (If a shop comes out)
Or maybe a password you say in-game to make you a VIP?


RE: Anyone want to add a VIP door - Aroblix - 01-25-2011

Code:
allowed = {"Guest","Aroblix",""} --Who is allowed through the door?
opentime = 1 --How much time will the door be open?
transparency = 0.5 --How transparent is the door when open?

function check(playername)
    for count,name in pairs(allowed) do
        if (string.lower(playername) == string.lower(name)) then
            return true
        end
    end
    return false
end


function open(part)
    if part.Parent:isA('Character') then
        if check(part.Parent.Name) then
            script.Parent.Collidable = false
            script.Parent.Transparency = transparency
            sleep(opentime)
            script.Parent.Collidable = true
            script.Parent.Transparency = 0
        end
    end
end
link(script.Parent.Collided, open)
--Coded by Aroblix.



RE: Anyone want to add a VIP door - ROBLOX - 01-30-2011

Yep Big Grin


RE: Anyone want to add a VIP door - Asai - 02-01-2011

What in the world is that scripting language?