Hi all,
in this script...
--Requested by DorianG
--Made by nErBoS
Bot = "MmSlot-Checker"
minSlot = 3
maxSlot = 5
addredirect = "llllaa.mine.nu"
function Main()
SetTimer(3*1000)
frmHub:RegBot(Bot)
end
--This function takes more memory, but searches the user slots when they speak or refresh userlist, in case if you want to remove.
function DataArrival(user, data) --remove from here
local _,b, slt = strfind(user.sMyInfoString,"S:(%x+)")
slt = slt*1
if (slt < minSlot) then
user:SendPM(Bot, "You must have "..minSlot.." slot open at least.")
user:SendPM(Bot, "You are been redirected...")
user:SendData("$ForceMove "..addredirect)
elseif (slt > maxSlot) then
user:SendPM(Bot, "You must have "..maxSlot.." slot open in max.")
user:SendData("$ForceMove "..addredirect)
user:SendPM(Bot, "You are been redirected...")
end
end --to here
-- This function only checks when the users connects
function NewUserConnected(user, data)
if strfind(user.sMyInfoString, "S:%x+") then
local _,b, slt = strfind(user.sMyInfoString,"S:(%x+)")
slt = slt*1
if (slt < minSlot) then
user:SendPM(Bot, "You must have "..minSlot.." slot open at least.")
user:SendData("$ForceMove "..addredirect)
user:SendPM(Bot, "You are been redirected...")
elseif (slt > maxSlot) then
user:SendPM(Bot, "You must have "..maxSlot.." slot open in max.")
user:SendData("$ForceMove "..addredirect)
user:SendPM(Bot, "You are been redirected...")
end
end
end
Is working but i am getting this erro on the editor..
Syntax Error: attempt to perform arithmetic on local `slt' (a nil value)
can anyone explained me why ??
Best regards, nErBoS
Try to use " %d* " instead of " %x+ " in strfind.
%x - is all hexadecimal digits
And for the safety;
slt = tonumber(slt)
Thanks for the explanition VidFamne.
Still having error...
Syntax Error: attempt to compare nil with number
yes, im getting that too and i would really like to know Why?
Is it that user's slot is == 0 and therefore nil?
(But that seems strange) or that it can't find the tag?
This error will appear even if you have 3 slots, but the script does their jobs but i dont understand way he sends this error.
Lets hope some big Scripter can explain :)
Best regards, nErBoS