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

Lua Error with /save & /commands Please help me Fix this issue.

johnnyflores961

New Member
Joined
Sep 26, 2012
Messages
44
Reaction score
1
When I say /save I get this error in my TFS CMD Lua Script Error: [TalkAction Interface] data/talkactions/scripts/save.lua:eek:nSay
data/talkactions/scripts/save.lua:13:attempt to perform arithmetic on local 'param' (a string value) stack traceback: [C]: in function '__mul' data/talkactions/scripts/save.lua

This is my XML
<?xml version="1.0" encoding="UTF-8"?>
<talkactions>
<!-- commands -->
<talkaction words="/save" separator=" " group="3" acctype="1" script="save.lua" />
This is my .LUA
local savingEvent = 0

local function save(delay)
doSaveServer()
if(delay > 0) then
savingEvent = addEvent(save, delay, delay)
end
end

function onSay(cid, words, param, channel)
if(param ~= 0) then
stopEvent(savingEvent)
save(param * 60 * 1000)
elseif(param == '') then
doSaveServer(false)
else
local tid = getPlayerByNameWildcard(param)
if(not tid or (isPlayerGhost(tid) and getPlayerGhostAccess(tid) > getPlayerGhostAccess(cid))) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.")
else
doPlayerSave(tid)
end
end

return true
end




Please if you can help me in any way with this issue I have been having that would be Amazing.



Also looking for help adding /commands




ALL FIXED!
 
Last edited:
Please advise of your TFS version in your future posts. (First line in the black box (cmd window) when your server starts can tell you your TFS version.)
It helps us, help you, faster and more accurately.

Also use code tags, when posting!
[.code]stuff here[./code] (without dots ...)


Try this. (just copied from sources)

/save
/save 3 -- 3 minute delay before saving
Code:
local savingEvent = 0

function onSay(cid, words, param, channel)
    if isNumber(param) then
        stopEvent(savingEvent)
        save(tonumber(param) * 60 * 1000)
    else
        doSaveServer()
    end
    return true
end

function save(delay)
    doSaveServer()
    if delay > 0 then
        savingEvent = addEvent(save, delay, delay)
    end
end
Super simple version.

/save
Code:
function onSay(cid, words, param, channel)
    doSaveServer()
    return true
end

-- Edit for other issue

Look here for where you can find other talkactions.
https://otland.net/threads/223832/#post-2388189

If you need additional help, please comment below.
If you feel your issue is solved, edit your title from the main post to 'solved', using the available drop downs.
 
Last edited:
I am still getting a Global Error
See Pic Here of Error Message when i Say /save
http://prnt.sc/ccefau




TFS 1.1
Use the super simple version.
It doesn't have extra stuff.

-- Edit
try this for 1.1 (maybe? Its what the source code says anyway)
Code:
function onSay(player, words, param)
    saveServer()
    return true
end
 
Last edited:
Where can I find " super simple version"
all I need it for is just to save before I restart server.
Code:
function onSay(player, words, param)
    saveServer()
    return true
end
Use this.
It should work fine.

Just use command on god character before you restart server.

/save

data/talkactions/talkactions.xml
Code:
<talkaction words="/save" script="save.lua" />
data/talkactions/scripts/save.lua
Code:
function onSay(player, words, param)
    saveServer()
    return true
end
 
Yes that worked!!! Thank you so much... Would you by chance have a XML and LUA script for /commands ? My ot does not have that script. I have tried Some but nothing worked.
 
Back
Top