Posted 30 September 2013 - 09:19 PM
Please help, it has to do with the variable "playerName"
Here's the code
Any response is appreciated, thanks!
Here's the code
local DOOR_OPEN_DURATION = 2.5
local hour = os.time()
p = peripheral.wrap("right")
local doorSide = "top"
local logFilePath = "/doorOpenLog"
local function welcome()
if playerName ~= "Grand_Panda" or "MajorCooke" or "austinv11" then
p.say("Welcome "..playerName.." to AustinCorp11")
elseif playerName == "Grand_Panda" then
p.say("Hey Panda, welcome to AustinCorp11 and have some Bamboo!")
elseif playerName == "MajorCooke" then
p.say("Salutes to the Major Cookie!")
elseif playerName == "austinv11" then
p.say("Welcome the owner of AustinCorp11!")
sleep(0.5)
p.say("*Claps")
end
end
local function logPlayerName (logFilePath, playerName)
local fileHandle = fs.open ("/doorOpenLog", "a")
if fileHandle then
fileHandle.writeLine(playerName.." at "..hour)
fileHandle.close()
return true
end
return false
end
local function openDoor()
rs.setBundledOutput(doorSide, 0)
sleep(DOOR_OPEN_DURATION)
rs.setBundledOutput(doorSide, 1)
end
local function main (logFilePath)
while true do
local _, playerName = os.pullEvent("player")
openDoor()
logPlayerName(logFilePath, playerName)
welcome()
p.say("Remember to finish the welcome() function!")
end
end
rs.setBundledOutput(doorSide, 1)
main()
Any response is appreciated, thanks!