1local talkaction = TalkAction("!report")
2
3function talkaction.onSay(player)
4 local storage = 6708 -- You can change the storage if its already in use
5 local delaytime = 30 -- Exhaust In Seconds.
6 if param == '' then
7 player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Command param required.")
8 return true
9 end
10 if player:getStorageValue(storage) <= os.time() then
11 player:sendTextMessage(MESSAGE_INFO_DESCR, "Your report has been received successfully!")
12 db.query("INSERT INTO `znote_player_reports` (`id` ,`name` ,`posx` ,`posy` ,`posz` ,`report_description` ,`date`)VALUES (NULL , " .. db.escapeString(player:getName()) .. ", '" .. player:getPosition().x .. "', '" .. player:getPosition().y .. "', '" .. player:getPosition().z .. "', " .. db.escapeString(param) .. ", '" .. os.time() .. "')")
13 player:setStorageValue(storage, os.time() + delaytime)
14 else
15 player:sendTextMessage(MESSAGE_STATUS_WARNING, "You have to wait " .. player:getStorageValue(storage) - os.time() .. " seconds to report again.")
16 end
17 return true
18end
19
20talkaction:separator(" ")
21talkaction:register()
22