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

C++ [TFS 1.2] !bugreports error, bad argument #2 to

PRLOts

Member
Joined
Jun 24, 2017
Messages
116
Solutions
4
Reaction score
15
Hey Otland!

I have problem with one thing, so:

report.lua in talkactions

Lua:
local config = {
    sep = '\n\n----------------------------------------------------------\n',
    storage = 6707,
    cooldown = 120,
    file = "data/logs/bugs.txt"
}
function onSay(player, words, param)
    local file = io.open(config.file, "a+")
    if not file then
        return print("Warning: Could not open ".. config.file)
    end
    if param == '' then
        return true
    end
    if player:getStorageValue(config.storage) >= os.time() then
        player:sendTextMessage(MESSAGE_EVENT_DEFAULT, 'You must wait '.. config.cooldown ..' seconds to use this command again')
        return false
    end
    local pos = player:getPosition()
    file:write(string.format("Date [%d] | Player: %s reported a bug at (X: %d, Y: %d, Z: %d) with description: %s%s", os.date(), player:getName(), pos.x, pos.y, pos.z, param, config.sep))
    file:close()
    player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Your report has been sent to " .. configManager.getString(configKeys.SERVER_NAME) .. '!')
    player:setStorageValue(config.storage, os.time() + config.cooldown)
    player:sendCancelMessage("Your report has been received successfully!")
    return false
end

And error in console:

error.png
 
Back
Top