Dankoo
Active Member
- Joined
- Sep 4, 2010
- Messages
- 1,007
- Reaction score
- 27
I've seen this script:
If I remove this line, the script runs smooth, but this is a crucial line:
attempt to index upvalue 'position' <a boolean value>
I've tried to fix, but couldn't... Ideas?
eace:
eace:
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 I remove this line, the script runs smooth, but this is a crucial line:
LUA:
Log:write("From position: X = "..position.x.." | Y = "..position.y.." | Z = "..position.z.."\n")
attempt to index upvalue 'position' <a boolean value>
I've tried to fix, but couldn't... Ideas?