Posted 23 February 2015 - 03:10 AM
Hello everyone. So i was putting my time into CC again, and i got very far this time with most of my programs, however one is clogging me up. Its a program for the OpenPeripheral Sensor, wich i wanted to open for specific players. Now i know this has been asked about before, but the mod updated, and it seems some stuff changed wich i cannot figure out how to fix. Firstly, here my code:
while true do
local users = {["LokeYourLord"] = true,
["Bassern"] = true}
for _, name in pairs(sensor.getPlayerByName()) do
if users[name] then
door = true
end
end
if door then
rs.setOutput("left",true)
else
rs.setOuzput("left",false)
end
sleep(1)
end
Now the problem with this one is that when i run the program, it says this: "door:5: Not enough arguments, first missing: username". I cannot figure out how to fix this, cause i came so far that i saw it changed the "getPlayerNames" to "getPlayerByName" by calling in "lua" the "peripheral.getMethods("top")", so i came that far, however i did change that as you can see in the code. What is wrong now?
Thanks in advance for the help :)/>
Spoiler
sensor = peripheral.wrap("top")while true do
local users = {["LokeYourLord"] = true,
["Bassern"] = true}
for _, name in pairs(sensor.getPlayerByName()) do
if users[name] then
door = true
end
end
if door then
rs.setOutput("left",true)
else
rs.setOuzput("left",false)
end
sleep(1)
end
Now the problem with this one is that when i run the program, it says this: "door:5: Not enough arguments, first missing: username". I cannot figure out how to fix this, cause i came so far that i saw it changed the "getPlayerNames" to "getPlayerByName" by calling in "lua" the "peripheral.getMethods("top")", so i came that far, however i did change that as you can see in the code. What is wrong now?
Thanks in advance for the help :)/>