Autor: Guitar Freak [[http://otland.net/f81/working-report-talkaction-0-3-a-44500/|klik]]
Licencja: Brak
Skrypt działa na zasadzie "normalnego" systemu reportów który mamy w tfsie lecz ten jest **lepszy** poniewaz gracz który zaraportuje "buga" mapy możemy sprawdzić gdzie on jest ponieważ wiadomość oraz pozycja gracza zapisuje się w folderze /data/logs/report.txt/
Teraz przechodzimy do konkretów!
**Część LUA**
Wchodzimy do folderu /data/lib/ otwieramy znajdujący się tam plik function.lua i wklejamy do niego:
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
Nastepnie przechodzimy do katalogu /data/talkactions/talkactions.xml/ i doklejamy linjkę:
Przechodzimy do /data/talkactions/scripts/ i tworzymy plik textreports.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
Testowany na tfs 0.3.4 oraz 0.3.5 ! Komendy w grze **/report tekst**