-
Notifications
You must be signed in to change notification settings - Fork 9
/
command-save.xml
32 lines (27 loc) · 1.06 KB
/
command-save.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?xml version="1.0" encoding="UTF-8"?>
<mod name="command-save" version="1.0" author="slawkens" contact="[email protected]" enabled="yes">
<config name="command-save-config"><![CDATA[
exhaust = 3 -- in minutes
storage = 3003 -- storage value used to save exhaustion
]]></config>
<talkaction words="!save" event="script"><![CDATA[
domodlib('command-save-config')
local config = {
exhaustion = exhaust,
storage = storage
}
function onSay(cid, words, param, channel)
if(exhaustion.check(cid, config.storage)) then
doPlayerSendCancel(cid, "You can save yourself only once per " .. config.exhaustion .. " minutes.")
return true
end
if(doPlayerSave(cid)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your character has been succesfully saved.")
exhaustion.set(cid, config.storage, config.exhaustion * 60)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Error while saving your character. Please try again later.")
end
return true
end
]]></talkaction>
</mod>