Need some LUA help with permissions please

drdax

Member
Joined
Jun 11, 2015
Messages
133
Hi, I know I am stuck on something simple.. again (LOL)

Could somenone give a quick pointer? I have bounced between the dungeon codes for a couple of days...

The objective is objective is to have locked cell with access via keypad terminal. 
So, here is what's working: locked cell, active area, building observers... selection of the terminal and options / some responses

Here is what not working: allowing / gving permission to player for the cell

1. I don't know if this is right for granting permission to the locked cell (for any keypad option)
2. second item, keycodes dontworl - but just selecting enter works -- wohoo !!

--- set permissions code -- Locked Door ----------------

pCell = getSceneObject(5800370)

if (pCell ~= nil) then
SceneObject(pCell):setContainerInheritPermissionsFromParent(false)
SceneObject(pCell):clearContainerDefaultAllowPermission(MOVEIN)
SceneObject(pCell):clearContainerDefaultDenyPermission(WALKIN)
end

--- grant access ( based on warren code ----

local pCell = getSceneObject(8575718)
if (pCell ~= nil) then
SceneObject(pCell):setContainerInheritPermissionsFromParent(false)
SceneObject(pCell):clearContainerDefaultAllowPermission(WALKIN)
CreatureObject(pCreature):sendSystemMessage(".......check - did it unlock cell?..........")
else
CreatureObject(pCreature):sendSystemMessage(".......it didnt work..........") 
end

I -------------- issues with key code working --

if (pressedButton == "enter") then
local pCell = getSceneObject(8575718)
if (pCell ~= nil) then

if (tonumber(enteredCode) == keypadCode) then
CreatureObject(pCreature):sendSystemMessage("Cell access granted") 
self:givePermission(pCreature, pCell)
end
else
CreatureObject(pCreature):sendSystemMessage("Wrong Code / or not wokring ") 
end
 
Top Bottom