PtokaX forum

Archive => Archived 5.1 boards => Finished Scripts => Topic started by: Djdirect on 21 February, 2007, 16:27:20

Title: Profile-prefix
Post by: Djdirect on 21 February, 2007, 16:27:20
-- Made by dEFiNE
-- Mod by nErBoS asked by Robban
-- Modded by Madman on request by exlepra

BotName = "-Bot-"

ISP = {
"[Reg]",
"[VIP]",
}

CheckProfiles = { --//Set the profiles you want to check to 1
[-1] = 0, -- Users (Unregged)
[0] = 0, -- Masters
[1] = 0, -- Operators
[2] = 0, -- VIP
[3] = 1, -- Reg
[4] = 0, -- Moderator
[5] = 0, -- NetFounder
}

function Main()
frmHub:RegBot(BotName)
end

function NewUserConnected(curUser)
if CheckProfiles[curUser.iProfile]==1 then
for key, value in ISP do
if (strlen(curUser.sName) >= strlen(value) and strsub(strlower(curUser.sName),1,strlen(value)) == strlower(value)) then
return 1
end
end
curUser:SendData(BotName, "Your nick should include one of this Prefix")
ISPList(curUser)
curUser:SendData(BotName, "For Example [REG]" ..curUser.sName)
curUser:Disconnect()
end
end

OpConnected = NewUserConnected

function ISPList(curUser)
local names = ""
for index, value in ISP do
names = names.." "..value.."\r\n\t"
end
curUser:SendData("\r\n\t" ..names)
end



a have this error  ptokax0351.lua\scripts\reg.lua:28: attempt to call a table value
Title: Re: Profile-prefix
Post by: Madman on 21 February, 2007, 19:08:10
Code (lua) Select

-- Made by dEFiNE
-- Mod by nErBoS asked by Robban
-- Modded by Madman on request by exlepra
-- Upgraded to Lua 5.1

BotName = "-Bot-"

ISP = {
"[Reg]",
"[VIP]",
}

CheckProfiles = { --//Set the profiles you want to check to 1
[-1] = 0, -- Users (Unregged)
[0] = 0, -- Masters
[1] = 0, -- Operators
[2] = 0, -- VIP
[3] = 1, -- Reg
[4] = 0, -- Moderator
[5] = 0, -- NetFounder
}

function Main()
frmHub:RegBot(BotName)
end

function NewUserConnected(curUser)
if CheckProfiles[curUser.iProfile]==1 then
for key, value in pairs(ISP) do
if (string.len(curUser.sName) >= string.len(value) and string.sub(string.lower(curUser.sName),1,string.len(value)) == string.lower(value)) then
return 1
end
end
curUser:SendData(BotName, "Your nick should include one of this Prefix")
ISPList(curUser)
curUser:SendData(BotName, "For Example [REG]" ..curUser.sName)
curUser:Disconnect()
end
end

OpConnected = NewUserConnected

function ISPList(curUser)
local names = ""
for index, value in pairs(ISP) do
names = names.." "..value.."\r\n\t"
end
curUser:SendData("\r\n\t" ..names)
end
Title: Re: Profile-prefix
Post by: Djdirect on 21 February, 2007, 21:08:15
Merci  ;) resolved