PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: juda on 17 February, 2005, 09:58:26

Title: Help please !!!
Post by: juda on 17 February, 2005, 09:58:26
I run script that must have users [prefix]before nick....
When user come into hub,get message:

MOTD__________________________________________
This is alowed prefixes:
[xxx]
[xxx]
[xxx]
[xxx]
[xxx]
[xxx]
[xxx]
and more....
_______________________________________________
Now it show this prefixes in single line,but I want that be
show in "paralel" line.....like:

MOTD__________________________________________
This is alowed prefixes:
[xxx],[xxx],[xxx],[xxx],[xxx],[xxx],[xxx],[xxx],[xxx],
[xxx],[xxx],[xxx],[xxx],[x[xxx],[xxx],[xxx],xx],[xxx],
...and more
_______________________________________________

This is line that must be change in script:
_______________________________________________
Copy from script "PrefixCheck by bastya_elvtars"

pref ={
"[EU]",
--"(HUN)",
--"(EU)",
}
___________________________________________________

I try all kind off different changes and still put all in single line !!!

Please for any tips !!!
Title:
Post by: blackwings on 17 February, 2005, 10:07:52
post the whole script please
Title: Here is script that I use
Post by: juda on 17 February, 2005, 14:41:27
____________________________________________
-- PrefixCheck by bastya_elvtars (the rock n' roll doctor)
-- based on AllowNick by Mutor
-- checks the prefix, it must be in right the beginning of the nick

-- // config

-- the next option defines who GET prefix checked, if checknick is set to 1.
cnlevel=3               -- 5:all users
                                -- 4 ops & below
                                -- 3 vips & below
                                -- 2 registered users & below
                                -- 1 guests only

pref ={
"[HUN]",
--"[EU]",
--"(HUN)",
}

-- // end of config

function DataArrival(user,data)
   if strsub(data, 1, 13) == "$ValidateNick" then
      local sdata=strsub(data,1,strlen(data)-1)
      local _,_,nm=strfind(sdata,"$ValidateNick%s+(%S+)")
      determineprefix(nm)
   end
end

function NewUserConnected(user)
   if CheckUserLevel(user) <= cnlevel then
      if checkprefix(user)=="shit" then  return 1 end
   end
end

function determineprefix(data)
   _,_,prefix = strfind(data, "^([%[%{%(]%S+[%)%}%]])%S+")
end

function checkprefix(user)
local p=function()
   local mess="\r\n====================\r\n"
   sort(pref)
   for b=1,getn(pref)do
      mess=mess..pref.."\r\n"
   end
   mess=mess.."====================\r\n\r\nNote that the check is case sensitive, a.k.a. [prefix] and [PREFIX] are different."
   return mess
   end
   if not prefix then
      user:SendData("NickNameCheck", "\r\nNo prefix specified, use one of these:"..p())
      user:Disconnect() return "shit"
   else
      local prefixes={}
      for a=1,getn(pref) do
         prefixes[pref[a]]=1
      end
      if not prefixes[prefix] then
         user:SendData("NickNameCheck", "\r\nBad prefix, use one of these:"..p())
         user:Disconnect() prefixes=nil return "shit"end
   end prefixes={}
end

function CheckUserLevel(user)
   if user.iProfile==0 then
      return 5
   elseif user.iProfile==1 then
      return 4
   elseif user.iProfile==3 then
      return 2
   elseif user.iProfile==2 then
      return 3
   else
      return 1
   end
end
_____________________________________________
Title:
Post by: blackwings on 17 February, 2005, 17:42:53
change this line (line 45) =
mess=mess..pref[b].."\r\n"
to this=
mess=mess..pref[b].." , "
this should work.
Title:
Post by: juda on 19 February, 2005, 07:14:10
work... !!! thanks m8 for your time...by