Hey Otland!
I have problem with one thing, so:
report.lua in talkactions
And error in console:
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: