• 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)

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

Thanks JDB and chris77. Updated first post and gave you both credit. :) Gave ya both Rep too. :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)

Lua:
function onSay(cid, words, param)
local config = {
	storage = 5565,
	seconds = 60
}	
		if(exhaustion.check(cid, config.storage) == TRUE) then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can only save your character every ".. config.seconds .." seconds.")
			return TRUE
		end
		if(exhaustion.check(cid, config.storage) ~= TRUE) then
			exhaustion.set(cid, config.storage, config.seconds)
			doPlayerSave(cid)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your character has succesfully been saved!")		
			return TRUE
		end
	end

At the end of data/lib/data.lua put this

Lua:
dofile(getDataDir() .. "lib/exhaustion.lua")

Not tested!
 
Last edited:
Code:
   local wait = 60
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (1000 * wait))

function onSay(cid, words, param)
player_name = getCreatureByName(cid)
    if isPlayer(cid) == TRUE and hasCondition(cid, CONDITION_EXHAUST) == FALSE then
        doPlayerSave(cid)
        doAddCondition(cid, exhaust)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have saved your character.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your character has succesfully been saved.")
    end
return TRUE
end

Working & Fixed.


#Edit
@Up
Sry, didn't saw your post ;d
 
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

:huh:
 
Code:
   local wait = 60
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (1000 * wait))

function onSay(cid, words, param)
player_name = getCreatureByName(cid)
    if isPlayer(cid) == TRUE and hasCondition(cid, CONDITION_EXHAUST) == FALSE then
        doPlayerSave(cid)
        doAddCondition(cid, exhaust)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have saved your character.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your character has succesfully been saved.")
    end
return TRUE
end

Working & Fixed.


#Edit
@Up
Sry, didn't saw your post ;d
What is the isPlayer(cid) for? It's not needed.
My wasn't same as yours, I used exhaustion.set you used condition lol :p
 
@Up
Rofl, did you even saw that script? It's not my script (it's jdb script) i just edited it because it wasn't working.

My script in the very first post is completely updated and working... just post what's not working for you. I've tested it on my Crying Damson.
 
The script in the first post is my script...

The ones under the first post were made because I didn't know a function existed...
Now I do, so forget those.
 
The script in the first post is my script...

The ones under the first post were made because I didn't know a function existed...
Now I do, so forget those.

Wait, what? o_O The first post script was made by me. :eek: You fixed the missing bracket. o.o
 
Yes, true forgot about that...
Sorry bro.

I added the message! :cool:
 
I think you're using mine right? I mean you just changed it -.-.

Which is why I put yours and Slawkens name in the credits? :O I changed it last night. Solved the scripting myself, but it didn't work till I did the Data thing.
 
Back
Top