Hi. First time poster. Long time reader. HeHe.
Anyhow, I just got the TriviaBot 2.1 and have been using it... However when i load the script it tells me that it has a syntax error, but everything looks like it works to me....
this is where i got the script...
http://207.44.232.77/~lysekil/script/lua/trivia(2.1).rar
this is the syntax error that it gives me...
Syntax Error: attempt to index local `curUser' (a nil value)
This is probably a really easy mistake that i made, but you guys need to set me straight. thanks...
thanks to past the entire script ...
Here is one possible problematic peice of code... I did not post all of the code before because it's just too big to post! I couldn't post it all now, so I gave you a part that might have a problem... That's why i provided people with a link to the source so they could inspect the whole thing on thier own.... Thanks guys, I hope someone could help me out...
Quotefunction Main()
frmHub:RegBot(BotName)
ReloadQuestions()
setlocale("swe")
LoadScores()
end
function NewUserConnected(curUser)
if (boolAutoLogin) then
if (not (playerArray[curUser.sName])) then
playerArray[curUser.sName] = 1
else
playerArray[curUser.sName] = nil
end
end
end
function OpConnected(curUser)
if (boolAutoLogin) then
if (not (playerArray[curUser.sName])) then
playerArray[curUser.sName] = 1
else
playerArray[curUser.sName] = nil
end
end
end
function UserDisconnected(curUser)
playerArray[curUser.sName] = nil
end
function OpDisconnected(curUser)
playerArray[curUser.sName] = nil
end
function DataArrival(curUser, data)
local boolPlaydata = nil
if (strsub(data, 1, 1) == "<") then
data = strsub(data, 1, (strlen(data) - 1))
if ((lngMode == 0) or (lngMode == 1)) then
boolPlaydata = 1
end
elseif (strsub(data, 1, 4) == "$To:") then
data = strsub(data, 1, (strlen(data) - 1))
local _, _, whoTo = strfind(data,"$To:%s+(%S+)")
if (whoTo == BotName) then
data = strsub(data, (15 + strlen(BotName) + strlen(curUser.sName)))
if (lngMode == 2) then
boolPlaydata = 1
end
end
end
Sorry... this part of code should work fine ...