• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Error - Spell Interface] (luaAddEvent) Callback parameter should be a function.

marszalikusowy

New Member
Joined
Jun 5, 2012
Messages
8
Reaction score
0
Hi. I've added a antibot system to my ots but I get this error.
Script:
Code:
-- configs
local mintoanswer = 2 -- minutes to answer anti bot system
local delayAntiBot = 45 -- minutes of delay of delayAntiBot
local maxgroupid = 2 -- groupid higher than this don't have antiBotSystem Activated
local prisionpos = {x=156, y=922, z=7} -- if don't answer, go to this pos
local prisionminutes = 60 -- time inside the prision
local templepos = {x=95, y=117, 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, 20, "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
Please help! :)
 
Code:
prisionEvent = addEvent(checkprisioned,1000,{cid=cid})
Code:
antiBotEvent = addEvent(antiBot,1000,{cid=cid})
checkprisioned and antiBot should be functions, if they aren't added somewhere else, it's nil atm, you have to add those functions to this script or a lib script.

Btw, can you post the full error? This is a creatureevent script, not a spell.
 
Ohhh I see I've posted the wrong title. haha.
Code:
[15/08/2014 01:02:21] [Error - CreatureScript Interface]
[15/08/2014 01:02:21] data/creaturescripts/scripts/antibot.lua:onLogin
[15/08/2014 01:02:21] Description:
[15/08/2014 01:02:21] (luaAddEvent) Callback parameter should be a function.
 
Last edited:
Back
Top