• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TalkAction !save(Saves character)

Dilio

Owner of Project Thala
Joined
Jun 8, 2008
Messages
188
Reaction score
7
Location
London, Ontario
Forgot to add instructions. :p

Step 1 -
Go to talkactions.
Step 2 -
Open talkactions.xml
Step 3 -
Go to your players section and add:
Code:
<talkaction words="!save" event="script" value="savecharacter.lua"/>
Step 4 -
Go to talkaction scripts.
Step 5 -
Create savecharacter.lua
Step 6 -
Finally add this code:
Lua:
local waittime = 30 --Default (30 seconds)
local storage = 5560

function onSay(cid, words, param, channel) 
	if exhaustion.get(cid, storage) == FALSE then
		doPlayerSave(cid)
		exhaustion.set(cid, storage, waittime)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have successfully saved your character.")
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You must wait another " .. exhaustion.get(cid, storage) .. " seconds.")
	end	
	return TRUE 
end
Step 7 -
Go to your lib folder, and at the end of data.lua
Add:
Lua:
dofile(getDataDir() .. "lib/exhaustion.lua")
Step 8 -
Save and your done.

Basically what this does is it saves the player without them having to logout, and I also added in a delay so it can't be spammed.

Useful if the player gets a Donation item and doesn't want to relog, or has PZ.

Default delay is 30 seconds.

Newest script (updated at last edit) - Will now tell you how many more seconds you need to wait, and uses a storage value as the exhaust. (Thanks again Slawkens and Zonet for the bit of codes)

Credits:
Me(Script)
Sizaro(Idea)
JDB and chris77(Fixing a bit)
Zonet(Idea/Fixing a bit)
Slawkens(exhaustion)
 
Last edited:
Lua:
local waittime = 30 --Default (30 seconds)
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (1000 * waittime))

function onSay(cid, words, param, channel) 
	if hasCondition(cid, CONDITION_EXHAUST) == FALSE then
		doPlayerSave(cid)
		doAddCondition(cid, exhaust)
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You must wait 30 seconds between each save."
	end	
	return TRUE 
end

Basically what this does is it saves the player without them having to logout, and I also added in a delay so it can't be spammed.

Useful if the player gets a Donation item and doesn't want to relog, or has PZ.

Default delay is 30 seconds.

Credits:
Me(Script)
Sizaro(Idea)

Bad bad bad.. "doPlayerSave(cid)" doesn't exist.
 
Forget this~
 
Last edited:
Forget this~
 
Last edited:
Uhm... it does exist in Crying Damson 0.3.4... I just went into my sources and checked the LuaScript, and it's there... ._.

It also works like it's meant to... I gave my character an item, typed !save, then crashed my server, and he still had the item after I brought it back up. So, besides the misunderstandings, what do ya guys think of the script?
 
Can anyone confirm this? Is this working? Then what of those scripts in this thread is working for 0.3.4 crying domson :p
 
It work, but use better use storages (exhaustion.set & exhaustion.get) or your character may be frozen with spells (But I'm not sure)
 
Cannot load script (data/talkactions/scripts/savecharacter.lua
data/talkactions/scripts/savecharacter.lua:11: ')' expected (to close '(' at line 10) near 'end'

short
 
The kid forgot a bracket ;p...

Code:
local waittime = 30 --Default (30 seconds)
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (1000 * waittime))

function onSay(cid, words, param, channel) 
        if hasCondition(cid, CONDITION_EXHAUST) == FALSE then
                doPlayerSave(cid)
                doAddCondition(cid, exhaust)
        else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You must wait 30 seconds between each save.")
        end     
        return TRUE 
end
 
The kid forgot a bracket ;p...

Code:
local waittime = 30 --Default (30 seconds)
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (1000 * waittime))

function onSay(cid, words, param, channel) 
        if hasCondition(cid, CONDITION_EXHAUST) == FALSE then
                doPlayerSave(cid)
                doAddCondition(cid, exhaust)
        else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You must wait 30 seconds between each save.")
        end     
        return TRUE 
end

Lol, thanks. --1st post updated.--
 
Lua:
local waittime = 30 --Default (30 seconds)
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (1000 * waittime))

function onSay(cid, words, param, channel) 
        if hasCondition(cid, CONDITION_EXHAUST) == FALSE then
                doPlayerSave(cid)
                doAddCondition(cid, exhaust)
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have successfully saved your character.")
        else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You must wait 30 seconds between each save.")
        end     
        return TRUE 
end
 
Back
Top