Guitar Freak
_LüA_n☺b_
First of all, credits to Shawak for the base script, to Colandus for his broadcast script (which I mixed and used as a reference for most stuff on this one) and myself for the minor modifications.
Second, it was tested and its working in 0.3+, including 0.3.5.
This talkaction will allow players to report bugs or w/e in-game and these reports will be sent to your /data/logs folder and will be written in a file called Reports.txt, which will be automatically updated every new report made.
They show the date sent, and the name, level and vocation of the sender. But you can change that by just removing some lines.
Well here it is.
First, go to folder data > lib and open function.lua and add this at the beginning:
Now in talkactions.xml:
In textreports.lua:
If you didnt understand what it does, here is an example:
Player1 says:
03:27 Player1 [30]: /report "Hi there is a map bug in temple, please fix..
After doing so, this message will appear to him in his log:
03:27 Report Manager:
03:27 You have successfully sent your report. Thanks for your support.
And in the file Reports.txt (go to your folder data, then logs) you will see this:
And every new report will appear there in the same format, 2 lines below the previous one, and so on.
Btw, if you want it to be /report Text, instead of /report "Text, just remove this:
From the line in talkactions.xml and it will work the same but without the ". Also, if you'd like them in .lua format instead of .txt, just change it on the script normally and will also work.
For an alternative and more complex version of this script for 0.3.5, check this one:
Version for 0.3.5 - Full credits to Shawak! :thumbup:
Enjoy.
PS: Notice that I use this script from before 0.3.5 appeared, so I dont know if 0.3.5 now has an easier way to do this.
Second, it was tested and its working in 0.3+, including 0.3.5.
This talkaction will allow players to report bugs or w/e in-game and these reports will be sent to your /data/logs folder and will be written in a file called Reports.txt, which will be automatically updated every new report made.
They show the date sent, and the name, level and vocation of the sender. But you can change that by just removing some lines.
Well here it is.
First, go to folder data > lib and open function.lua and add this at the beginning:
Lua:
function setExhaust(cid, storage)
setPlayerStorageValue(cid, storage, os.time())
end
function isExhausted(cid, storage, exhaust)
local exhaustTime = getPlayerStorageValue(cid, storage)
if exhaustTime == -1 then
return FALSE
end
local isExhausted = os.time() - exhaustTime < exhaust
return isExhausted and TRUE or FALSE
end
Now in talkactions.xml:
PHP:
<talkaction log="no" words="/report" filter="quotation" event="script" value="textreports.lua"/>
In textreports.lua:
Lua:
-- Credits --
-- References: Shawak & Colandus.
-- Modifications: Guitar Freak.
local level = 8 -- Minimum level to send a report.
local minimum = 3 -- Minimum characters per report.
local maximum = 85 -- Maximum characters per report.
local useExhaust = true -- True if you want to use exhaustion, false if not.
local storageValue = 8000 -- Needed for exhaustion to work. Set to any unused value you wish.
local exhaustTime = 15 -- Exhaust time between each report (15 = 15 seconds).
local getVoc = getPlayerVocationName(cid)
local position = getCreaturePosition(cid)
function onSay(cid, words, param, channel)
if getPlayerLevel(cid) < level then
doPlayerSendTextMessage(cid,20,"Report Manager:")
doPlayerSendTextMessage(cid,18,"You need to be at least level "..level.." to send a report.")
elseif (useExhaust and isExhausted(cid, storageValue, exhaustTime) == TRUE) then
doPlayerSendTextMessage(cid,20,"Report Manager:")
doPlayerSendTextMessage(cid,18,"Sorry, you need to wait "..exhaustTime.." seconds before sending another report.")
elseif param:len() < minimum then
doPlayerSendTextMessage(cid,20,"Report Manager:")
doPlayerSendTextMessage(cid,18,"Sorry, you need to enter atleast " .. minimum .. " characters to send in a report.")
elseif param:len() > maximum then
doPlayerSendTextMessage(cid,20,"Report Manager:")
doPlayerSendTextMessage(cid,18,"Sorry, you can only write max. " .. maximum .. " characters per report.")
else
Log = io.open(getDataDir().."logs/Reports.txt", "a+")
Log:write("Sent: "..os.date("%A %I:%M:%S %p.").."\n")
Log:write("From position: X = "..position.x.." | Y = "..position.y.." | Z = "..position.z.."\n")
Log:write(""..getPlayerName(cid).." ["..getPlayerLevel(cid).."] ("..getVoc.."): "..param.."\n\n")
Log:close()
doPlayerSendTextMessage(cid,20,"Report Manager:")
doPlayerSendTextMessage(cid,27,"You have successfully sent your report. Thanks for your support.")
setExhaust(cid, storageValue)
end
return TRUE
end
If you didnt understand what it does, here is an example:
Player1 says:
03:27 Player1 [30]: /report "Hi there is a map bug in temple, please fix..
After doing so, this message will appear to him in his log:
03:27 Report Manager:
03:27 You have successfully sent your report. Thanks for your support.
And in the file Reports.txt (go to your folder data, then logs) you will see this:
Sent: Saturday 03:27:10 PM.
From position: X = 158 | Y = 51 | Z = 7
Player1 [30] (Knight): Hi there is a map bug in temple, please fix..
And every new report will appear there in the same format, 2 lines below the previous one, and so on.
Btw, if you want it to be /report Text, instead of /report "Text, just remove this:
Code:
filter="quotation"
From the line in talkactions.xml and it will work the same but without the ". Also, if you'd like them in .lua format instead of .txt, just change it on the script normally and will also work.
For an alternative and more complex version of this script for 0.3.5, check this one:
Version for 0.3.5 - Full credits to Shawak! :thumbup:
Enjoy.
PS: Notice that I use this script from before 0.3.5 appeared, so I dont know if 0.3.5 now has an easier way to do this.
Last edited: