Orkanite
omfg mapper
- Joined
- May 11, 2008
- Messages
- 365
- Reaction score
- 115
Is there a way to get/set a player's particular storage value who is currently offline?
Here is my scrub storage talkaction that gets/sets online players' storage values
I couldn't find this question clearly being asked and answered, please let me know and I or another can delete this thread.
Here is my scrub storage talkaction that gets/sets online players' storage values
Lua:
function all_trim(s)
return s:match( "^%s*(.-)%s*$" )
end
function onSay(cid, words, param, channel)
if(param == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
return TRUE
end
--t1 playername
--t2 get/set
--t3 storageID
--t4 (only used for "set" mode, value to set for storageID)
local t = string.split(param, ",")
local player = Creature(all_trim(t[1]))
if (all_trim(t[2]) == "get") then
local storageValue = player:getStorageValue(t[3])
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. all_trim(t[1]) .. "'s storage with ID " .. all_trim(t[3]) .. " is currently " .. storageValue)
else
if (all_trim(t[2]) == "set") then
player:setStorageValue(t[3], t[4])
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. all_trim(t[1]) .. "'s storage with ID " .. all_trim(t[3]) .. " has been set to " .. all_trim(t[4]))
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Unknown storage command.try 'get' and 'set' followed by comma followed by self storage id")
end
end
return TRUE
end
I couldn't find this question clearly being asked and answered, please let me know and I or another can delete this thread.