Update
# v1.2.2 - Add a way to disable datastore usage. Just set the dataStoreKey to nothing - Add "CHIME" text when chime enabled
This commit is contained in:
parent
4f5e6616de
commit
a1407a8e40
Binary file not shown.
|
@ -1,14 +1,31 @@
|
|||
local defaultCodes = {"1234"}
|
||||
|
||||
local dataStore = nil
|
||||
local DataStoreService = game:GetService("DataStoreService")
|
||||
local dataStore = DataStoreService:GetDataStore('securityCodes-' .. script.Parent.dataStoreKey.Value or "XP-99")
|
||||
dataStoreKey = script.Parent.dataStoreKey.Value
|
||||
if dataStoreKey ~= "" then
|
||||
dataStore = DataStoreService:GetDataStore('securityCodes-' .. script.Parent.dataStoreKey.Value or "XP-99")
|
||||
else
|
||||
-- Make virtual datastore for offline use
|
||||
dataStore = {
|
||||
_data = {},
|
||||
GetAsync = function(self, key)
|
||||
return self._data[key]
|
||||
end,
|
||||
SetAsync = function(self, key, value)
|
||||
self._data[key] = value
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
function setup(parentScript)
|
||||
-- dont touch
|
||||
version = "v1.2.1"
|
||||
local version = "v1.2.2"
|
||||
|
||||
-- codes object, will be swapped for data store later
|
||||
codes = dataStore:GetAsync("codes")
|
||||
if not codes then
|
||||
codes = {"1234"}
|
||||
codes = defaultCodes
|
||||
dataStore:SetAsync("codes", codes)
|
||||
end
|
||||
|
||||
|
@ -201,7 +218,11 @@ delay
|
|||
else
|
||||
ux.setLEDs(keypads, "ready", true)
|
||||
ux.setLEDs(keypads, "armed", false)
|
||||
ux.setDisplays(keypads, "****DISARMED****", " READY TO ARM ")
|
||||
if not chime then
|
||||
ux.setDisplays(keypads, "****DISARMED****", " READY TO ARM ")
|
||||
else
|
||||
ux.setDisplays(keypads, " DISARMED CHIME ", " READY TO ARM *")
|
||||
end
|
||||
end
|
||||
elseif armState == 1 then -- We are armed stay
|
||||
ux.setLEDs(keypads, "armed", true)
|
||||
|
@ -328,6 +349,7 @@ delay
|
|||
elseif key == "8" then
|
||||
-- If the code used was code 1, and the system is disarmed, Set inputMode to 2 (code change)
|
||||
-- See what index the code is at, if its index 1, its the right code, set mode to 2. do NOT hardcode the code here
|
||||
print(codes[1] .. " : " .. authedUser)
|
||||
if codes[1] == authedUser then
|
||||
inputMode = 2
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue