• 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 A better way to report bugs

Use it, tooked 5 minutes.

Code:
local config = {
    storage = 6707,
    cooldown = 120,
    file = "data/logs/bugs.log"
}

function onSay(player, words, param)
    local file = io.open(config.file, "a")
    if not file then
        print(string.format("Warning: Could not open %s", config.file))
        return true
    end

    local split = param:split(",")
    local action = split[1]

    if (action == nil) then
        return true
    end

    if player:getStorageValue(config.storage) >= os.time() then
        player:sendTextMessage(MESSAGE_INFO_DESCR, string.format('You must wait %d seconds to use this command again', config.cooldown))
        return false
    end

    io.output(file)
    io.write("------------------------------\n")
    local position = player:getPosition()
    player:sendTextMessage(MESSAGE_INFO_DESCR, string.format('[%s] - Player %s reported a bug at %d, %d, %d with description: %s.', os.date("%c"), player:getName(), position.x, position.y, position.z, param))
    player:setStorageValue(config.storage, os.time() + config.cooldown)
    player:sendCancelMessage("Your report has been received successfully!")
    return false
end
So i tried this and reloaded it and it doesnt do anything with no errors, i am guessing i put something like '!report bug found here' and i also have it in talkactions.xml

Code:
<talkaction words="!report" script="report.lua"/>
 
So i tried this and reloaded it and it doesnt do anything with no errors, i am guessing i put something like '!report bug found here' and i also have it in talkactions.xml

Code:
<talkaction words="!report" script="report.lua"/>

Use separator=" "
 
Ok so i tried testing it today and i got this :| no errors also.

VuORRuQ.png


But it looks like this works

vFzTwGM.png
 
After a request made by me, Bogart helped me here: [Talkaction] Bug Report [CLOSED] (http://otland.net/f132/talkaction-bug-report-147010/#post1414381)
Credits to him, not to me.

How it works
When player report a bug it will be saved in "data/logs/bugs.txt". 120 seconds(2min) of delay added to prevent spammers.

in talkactions.xml add
XML:
    <talkaction words="!bugreport;/bugreport" event="script" value="bugreport.lua"/>

create .lua file and rename to "bugreport.lua".
Lua:
function onSay(cid, words, param, channel)
local storage = 6707
local delaytime = 120
local a = "data/logs/bugs.txt"
local f = io.open(a, "a+")
    if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
        return true
    end
local exhaust = exhaustion.get(cid, storage)
    if(not exhaust) then
        exhaustion.set(cid, storage, delaytime)
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your report has been received successfully!")
        f:write(""..getPlayerName(cid).." reported a bug at " .. os.date("%d %B %Y - %X.", os.time()) .."\n"..param.." [x="..getPlayerPosition(cid).x..", y="..getPlayerPosition(cid).y..", z="..getPlayerPosition(cid).z.."].\n\n----------------------------------------------------------\n")
        f:close()
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You must wait " .. exhaustion.get(cid, storage) .. " seconds to report.")
    end
return TRUE
end

How to use
Code:
!bugreport, [I][COLOR="#FF0000"]your comment[/COLOR][/I]

Example
Code:
Druid reported a bug at 21 December 2011 - 20:24:42
There is a bug in Carlin Wall. [x=32360, y=31782, z=7].

----------------------------------------------------------
Sorcerer reported a bug at 21 December 2011 - 20:28:01
Help me i cant move. [x=11457, y=45789, z=5].

----------------------------------------------------------
TFS 1.2 dont work
 
Back
Top