Lua Script Error: [CreatureScript Interface]
in a timer event called from:
data/creaturescripts/scripts/anti-bot.luanLogin
luaGetCreaturePosition(). Creature not found
Lua Script Error: [CreatureScript Interface]
in a timer event called from:
data/creaturescripts/scripts/anti-bot.luanLogin
attempt to index a number value
stack traceback:
[C]: in function 'getTilePzInfo'
data/creaturescripts/scripts/anti-bot.lua:61: in function <data/creature
scripts/scripts/anti-bot.lua:57>
Lua Script Error: [CreatureScript Interface]
in a timer event called from:
data/creaturescripts/scripts/anti-bot.luanLogin
luaGetCreaturePosition(). Creature not found
Lua Script Error: [CreatureScript Interface]
in a timer event called from:
data/creaturescripts/scripts/anti-bot.luanLogin
attempt to index a number value
stack traceback:
[C]: in function 'getTilePzInfo'
data/creaturescripts/scripts/anti-bot.lua:61: in function <data/creature
scripts/scripts/anti-bot.lua:57>
lol not work in new tfs, (crying....)
i say correct answer and script say its wrong, i say correct answer again and script say wrong, my time limit and i go teleported for prision.
10:08 Anti Bot System: Hello, Belthazoro! You have 1 minute(s) to answer how much is 4 + 3. To answer say: !antibot "number.
10:08 Anti Bot System: Example: 20+20 = 40, then you would say !antibot "40.
10:09 Anti Bot System: Wrong answer!
10:09 Anti Bot System: You had already got 1 wrong answers! The limit is 3.
10:09 Anti Bot System: Right answer, thank you for answering.
-- configs
local mintoanswer = 1 -- minutes to answer anti bot system
local delayAntiBot = 30 -- minutes of delay of delayAntiBot
local maxgroupid = 3 -- groupid higher than this don't have antiBotSystem Activated
local prisionpos = {x=32196,y=32260,z=7} -- if don't answer, go to this pos
local prisionminutes = 30 -- time inside the prision
local templepos = {x=32369, y=32241, z=7} -- after the prisionminutes, back to this position (temple is recommended)
-- end configs
-- local variables
local storages = {first_num = 20123, second_num = 20124, result = 20125, answer = 20126, prisioned = 20127, prisiontime = 20128, wrong_answers = 20129}
-- end local variables
function onLogin(cid)
local prisioned = getPlayerStorageValue(cid,storages.prisioned)
if (prisioned == 1) then
local prisiontime = getPlayerStorageValue(cid,storages.prisiontime)
local timenow = os.time()
if (timenow >= prisiontime) then
setPlayerStorageValue(cid,storages.prisiontime,0)
setPlayerStorageValue(cid,storages.prisioned,0)
doTeleportThing(cid, templepos)
else
prisionEvent = addEvent(checkprisioned,1000,{cid=cid})
doTeleportThing(cid, prisionpos)
end
end
if (delayAntiBot <= mintoanswer) then
debugPrint("Error! Anti Bot System debugs: variable delayAntiBot need to be higher than mintoanswer.")
else
if (getPlayerGroupId(cid) <= maxgroupid) then
antiBotEvent = addEvent(antiBot,1000,{cid=cid})
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "People with group ID higher than ".. maxgroupid .." don't have this system.")
end
end
return TRUE
end
function onLogout(cid)
stopEvent(prisionEvent)
stopEvent(antiBotEvent)
stopEvent(checkAnswerEvent)
setPlayerStorageValue(cid,storages.first_num,0)
setPlayerStorageValue(cid,storages.second_num,0)
setPlayerStorageValue(cid,storages.result,0)
setPlayerStorageValue(cid,storages.answer,0)
setPlayerStorageValue(cid,storages.wrong_answers,0)
return TRUE
end
function antiBot(parameters)
local cid = parameters.cid
local playerpos = getCreaturePosition(cid)
local playername = getPlayerName(cid)
local prisioned = getPlayerStorageValue(cid,storages.prisioned)
if (prisioned ~= 1) then
local first_num = math.random(1,9)
local second_num = math.random(1,999)
local result = first_num+second_num
setPlayerStorageValue(cid,storages.first_num,first_num)
setPlayerStorageValue(cid,storages.second_num,second_num)
setPlayerStorageValue(cid,storages.result,result)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Anti Bot System: Hello, "..playername.."! You have ".. mintoanswer .." minute(s) to answer what nummber this is >>> (".. second_num .."). To answer say: !antibot \"number.")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Anti Bot System: Example: 20, Anti Bot System: Hello, Belthazor! You have 1 minute(s) to answer what nummber this is >>> (130). To answer say: !antibot \"130..")
checkAnswerEvent = addEvent(checkAnswer,mintoanswer*60*1000,{cid=cid})
end
antiBotEvent = addEvent(antiBot,delayAntiBot*60*1000,{cid=cid})
end
function checkAnswer(parameters)
local cid = parameters.cid
local first_num, second_num, result, answer, prisioned = getPlayerStorageValue(cid,storages.first_num), getPlayerStorageValue(cid,storages.second_num), getPlayerStorageValue(cid,storages.second_num), getPlayerStorageValue(cid,storages.result), getPlayerStorageValue(cid,storages.answer), getPlayerStorageValue(cid,storages.prisioned)
local wrong_answers = getPlayerStorageValue(cid,storages.wrong_answers)
if (wrong_answers > 3) then
doTeleportThing(cid, prisionpos)
setPlayerStorageValue(cid,storages.wrong_answers,0)
setPlayerStorageValue(cid,storages.first_num,0)
setPlayerStorageValue(cid,storages.second_num,0)
setPlayerStorageValue(cid,storages.result,0)
setPlayerStorageValue(cid,storages.answer,0)
setPlayerStorageValue(cid,storages.prisioned,1)
setPlayerStorageValue(cid,storages.prisiontime,os.time()+(prisionminutes*60))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Time limit! You had been prisioned for ".. prisionminutes .." minute(s) because answered many wrong times.")
prisionEvent = addEvent(checkprisioned,1000,{cid=cid})
else
if (answer ~= 1 and prisioned ~= 1 and result > 0) then
doTeleportThing(cid, prisionpos)
setPlayerStorageValue(cid,storages.first_num,0)
setPlayerStorageValue(cid,storages.second_num,0)
setPlayerStorageValue(cid,storages.result,0)
setPlayerStorageValue(cid,storages.answer,0)
setPlayerStorageValue(cid,storages.prisioned,1)
setPlayerStorageValue(cid,storages.wrong_answers,0)
setPlayerStorageValue(cid,storages.prisiontime,os.time()+(prisionminutes*60))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Time limit! You had been prisioned for ".. prisionminutes .." minute(s).")
prisionEvent = addEvent(checkprisioned,1000,{cid=cid})
else
setPlayerStorageValue(cid,storages.first_num,0)
setPlayerStorageValue(cid,storages.second_num,0)
setPlayerStorageValue(cid,storages.result,0)
setPlayerStorageValue(cid,storages.answer,0)
setPlayerStorageValue(cid,storages.prisioned,0)
setPlayerStorageValue(cid,storages.wrong_answers,0)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Anti Bot System: You are ok, but in some minutes you are going to be asked again.")
end
end
end
function checkprisioned(parameters)
local cid = parameters.cid
local prisioned = getPlayerStorageValue(cid,storages.prisioned)
local prisiontime = getPlayerStorageValue(cid,storages.prisiontime)
local timenow = os.time()
if (prisioned == 1) then
if (timenow >= prisiontime) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You had completed your time here in the prision! You may now relog to go to the city.")
else
prisionEvent = addEvent(checkprisioned,1000,{cid=cid})
end
end
end
Dude have how the script works only when the player is on X floor? Cuz for example it will be good for who is only training know?
Regards.
Lua script Error: [creatureScript Interface]
in a timer event called from:
data/creaturescripts/scripts/antibot.lua:onLogin
attempt to index a nill value
stack traceback:
[C]: in function 'getTileInfo'
data/lib/function.lua:337: in function 'getTilePzInfo'
data/creaturescripts/scripts/antibot.lua:61: in function <data/creaturescripts/scripts/antibot.lua:57>]
@ Belthazor
Im using your script and im getting this error
Code:Lua script Error: [creatureScript Interface] in a timer event called from: data/creaturescripts/scripts/antibot.lua:onLogin attempt to index a nill value stack traceback: [C]: in function 'getTileInfo' data/lib/function.lua:337: in function 'getTilePzInfo' data/creaturescripts/scripts/antibot.lua:61: in function <data/creaturescripts/scripts/antibot.lua:57>]
Halp plx!
-- configs
local mintoanswer = 1 -- minutes to answer anti bot system
local delayAntiBot = 30 -- minutes of delay of delayAntiBot
local maxgroupid = 3 -- groupid higher than this don't have antiBotSystem Activated
local prisionpos = {x=32196,y=32260,z=7} -- if don't answer, go to this pos
local prisionminutes = 30 -- time inside the prision
local templepos = {x=32369, y=32241, z=7} -- after the prisionminutes, back to this position (temple is recommended)
-- end configs
-- local variables
local storages = {first_num = 20123, second_num = 20124, result = 20125, answer = 20126, prisioned = 20127, prisiontime = 20128, wrong_answers = 20129}
-- end local variables
function onLogin(cid)
local prisioned = getPlayerStorageValue(cid,storages.prisioned)
if (prisioned == 1) then
local prisiontime = getPlayerStorageValue(cid,storages.prisiontime)
local timenow = os.time()
if (timenow >= prisiontime) then
setPlayerStorageValue(cid,storages.prisiontime,0)
setPlayerStorageValue(cid,storages.prisioned,0)
doTeleportThing(cid, templepos)
else
prisionEvent = addEvent(checkprisioned,1000,{cid=cid})
doTeleportThing(cid, prisionpos)
end
end
if (delayAntiBot <= mintoanswer) then
debugPrint("Error! Anti Bot System debugs: variable delayAntiBot need to be higher than mintoanswer.")
else
if (getPlayerGroupId(cid) <= maxgroupid) then
antiBotEvent = addEvent(antiBot,1000,{cid=cid})
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "People with group ID higher than ".. maxgroupid .." don't have this system.")
end
end
return TRUE
end
function onLogout(cid)
stopEvent(prisionEvent)
stopEvent(antiBotEvent)
stopEvent(checkAnswerEvent)
setPlayerStorageValue(cid,storages.first_num,0)
setPlayerStorageValue(cid,storages.second_num,0)
setPlayerStorageValue(cid,storages.result,0)
setPlayerStorageValue(cid,storages.answer,0)
setPlayerStorageValue(cid,storages.wrong_answers,0)
return TRUE
end
function antiBot(parameters)
local cid = parameters.cid
local playerpos = getCreaturePosition(cid)
local playername = getPlayerName(cid)
local prisioned = getPlayerStorageValue(cid,storages.prisioned)
if (prisioned ~= 1) then
local first_num = math.random(1,9)
local second_num = math.random(1,999)
local result = first_num+second_num
setPlayerStorageValue(cid,storages.first_num,first_num)
setPlayerStorageValue(cid,storages.second_num,second_num)
setPlayerStorageValue(cid,storages.result,result)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Anti Bot System: Hello, "..playername.."! You have ".. mintoanswer .." minute(s) to answer what nummber this is >>> (".. second_num .."). To answer say: !antibot \"number.")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Anti Bot System: Example: 20, Anti Bot System: Hello, Belthazor! You have 1 minute(s) to answer what nummber this is >>> (130). To answer say: !antibot \"130..")
checkAnswerEvent = addEvent(checkAnswer,mintoanswer*60*1000,{cid=cid})
end
antiBotEvent = addEvent(antiBot,delayAntiBot*60*1000,{cid=cid})
end
function checkAnswer(parameters)
local cid = parameters.cid
local first_num, second_num, result, answer, prisioned = getPlayerStorageValue(cid,storages.first_num), getPlayerStorageValue(cid,storages.second_num), getPlayerStorageValue(cid,storages.second_num), getPlayerStorageValue(cid,storages.result), getPlayerStorageValue(cid,storages.answer), getPlayerStorageValue(cid,storages.prisioned)
local wrong_answers = getPlayerStorageValue(cid,storages.wrong_answers)
if (wrong_answers > 3) then
doTeleportThing(cid, prisionpos)
setPlayerStorageValue(cid,storages.wrong_answers,0)
setPlayerStorageValue(cid,storages.first_num,0)
setPlayerStorageValue(cid,storages.second_num,0)
setPlayerStorageValue(cid,storages.result,0)
setPlayerStorageValue(cid,storages.answer,0)
setPlayerStorageValue(cid,storages.prisioned,1)
setPlayerStorageValue(cid,storages.prisiontime,os.time()+(prisionminutes*60))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Time limit! You had been prisioned for ".. prisionminutes .." minute(s) because answered many wrong times.")
prisionEvent = addEvent(checkprisioned,1000,{cid=cid})
else
if (answer ~= 1 and prisioned ~= 1 and result > 0) then
doTeleportThing(cid, prisionpos)
setPlayerStorageValue(cid,storages.first_num,0)
setPlayerStorageValue(cid,storages.second_num,0)
setPlayerStorageValue(cid,storages.result,0)
setPlayerStorageValue(cid,storages.answer,0)
setPlayerStorageValue(cid,storages.prisioned,1)
setPlayerStorageValue(cid,storages.wrong_answers,0)
setPlayerStorageValue(cid,storages.prisiontime,os.time()+(prisionminutes*60))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Time limit! You had been prisioned for ".. prisionminutes .." minute(s).")
prisionEvent = addEvent(checkprisioned,1000,{cid=cid})
else
setPlayerStorageValue(cid,storages.first_num,0)
setPlayerStorageValue(cid,storages.second_num,0)
setPlayerStorageValue(cid,storages.result,0)
setPlayerStorageValue(cid,storages.answer,0)
setPlayerStorageValue(cid,storages.prisioned,0)
setPlayerStorageValue(cid,storages.wrong_answers,0)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Anti Bot System: You are ok, but in some minutes you are going to be asked again.")
end
end
end
function checkprisioned(parameters)
local cid = parameters.cid
local prisioned = getPlayerStorageValue(cid,storages.prisioned)
local prisiontime = getPlayerStorageValue(cid,storages.prisiontime)
local timenow = os.time()
if (prisioned == 1) then
if (timenow >= prisiontime) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You had completed your time here in the prision! You may now relog to go to the city.")
else
prisionEvent = addEvent(checkprisioned,1000,{cid=cid})
end
end
end