2 posts
Posted 04 July 2014 - 09:47 AM
Hello,
I'm very new on ComputerCraft, but w're playing CrackPack with some friends. And I wan't to protect my door, but not that old password door. I prefer having a whitelist, and if a player does right click that (via ps.Pullevent) their name wil be checked against a list.
If tried
thistopic, but it's seems outdated and I can't get it to work.
I realy hope you guys can help me out!
Best Wishes,
Jeroen!
14 posts
Posted 04 July 2014 - 05:05 PM
Perhaps something like:
local playerDetector = peripheral.wrap("side") --Change "side" to whatever side it is on
while true do
local event, player = os.pullEvent("player")
if player == "Some player, or maybe a table for multiple players" then
print("Valid player. Opening door.")
redstone.setOutput("side", true)
sleep(2)
redstone.setOutput("same_side", false)
else
print("You have not been whitelisted!")
os.shutdown()
end
end
Though I haven't used Misc. Peripherals before, I think that would be the basic idea that you want.
Edited on 04 July 2014 - 03:13 PM
3057 posts
Location
United States of America
Posted 04 July 2014 - 05:27 PM
Just a suggestion, for whitelist use tables.
local whitelist = {}
whitelist[ "player" ] = true
whitelist[ "otherplayer" ] = true
if whitelist[ player ] then
--#other code
else
--#more code
end
2 posts
Posted 11 July 2014 - 06:12 PM
Perhaps something like:
local playerDetector = peripheral.wrap("side") --Change "side" to whatever side it is on
while true do
local event, player = os.pullEvent("player")
if player == "Some player, or maybe a table for multiple players" then
print("Valid player. Opening door.")
redstone.setOutput("side", true)
sleep(2)
redstone.setOutput("same_side", false)
else
print("You have not been whitelisted!")
os.shutdown()
end
end
Though I haven't used Misc. Peripherals before, I think that would be the basic idea that you want.
I used your code but it didn't work, gave no errors but shows just a black screen.
8 posts
Location
Netherlands
Posted 22 July 2014 - 07:40 PM
Perhaps something like:
local playerDetector = peripheral.wrap("side") --Change "side" to whatever side it is on while true do local event, player = os.pullEvent("player") if player == "Some player, or maybe a table for multiple players" then print("Valid player. Opening door.") redstone.setOutput("side", true) sleep(2) redstone.setOutput("same_side", false) else print("You have not been whitelisted!") os.shutdown() end end
Though I haven't used Misc. Peripherals before, I think that would be the basic idea that you want.
I used your code but it didn't work, gave no errors but shows just a black screen.
Well, if you just copied the code then it checks if your name is "Some player, or maybe a table for multiple players" - So I guess you'll have to change that to your own name for example ;)/>