PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: gathering on 17 December, 2004, 16:50:14

Title: plop help
Post by: gathering on 17 December, 2004, 16:50:14
in texter 4.5 how do i get the nick to be shown on the user that writes the CMD

example

CMD +wc

shows

----------------->[user] Siger



        \\\II///
        /  0 0 \  
        \c  --_)      
           ) (          
           /  \          
_o _  /   \  \ _
I    I  /     / \ _O__
I    I_((_______    I
\                /    / /_
  \______ /     (___)Jeg er lige p? potten ;o)
Title:
Post by: [_XStaTiC_] on 17 December, 2004, 17:45:19
Replace this code

function showtext(user, file, where)
local handle = openfile(FDFolder.."/"..file..".txt", "r")
local contents = gsub(read(handle, "*a"),strchar(10), "\r\n")
closefile (handle)
   if where == "main" then
      user:SendData(Bot, "\r\n"..contents.."\r\n|")
   elseif where == "allmain" then
      SendToAll(Bot, "\r\n"..contents.."\r\n|")
   elseif where == "allpm" then
      SendPmToAll(Bot, "\r\n"..contents.."\r\n|")
   else
      user:SendPM(Bot, "\r\n"..contents.."\r\n|")
   end
end

for this

function showtext(user, file, where)
local handle = openfile(FDFolder.."/"..file..".txt", "r")
local content = gsub(read(handle, "*a"),strchar(10), "\r\n")
closefile (handle)
        contents = gsub(content, "%b[USER]",user.sName)
   if where == "main" then
      user:SendData(Bot, "\r\n"..contents.."\r\n|")
   elseif where == "allmain" then
      SendToAll(Bot, "\r\n"..contents.."\r\n|")
   elseif where == "allpm" then
      SendPmToAll(Bot, "\r\n"..contents.."\r\n|")
   else
      user:SendPM(Bot, "\r\n"..contents.."\r\n|")
   end
end


and put in every txt file [USER]
Title:
Post by: gathering on 19 December, 2004, 20:23:18
dosen?t work
Title:
Post by: plop on 20 December, 2004, 17:54:04
try this 1.
function showtext(user, file, where)
   local handle = openfile(FDFolder.."/"..file..".txt", "r")
   local content = gsub(read(handle, "*a"),strchar(10), "\r\n")
   closefile (handle)
   contents = gsub(content, "%[USER]",user.sName)
   if where == "main" then
      user:SendData(Bot, "\r\n"..contents.."\r\n|")
   elseif where == "allmain" then
      SendToAll(Bot, "\r\n"..contents.."\r\n|")
   elseif where == "allpm" then
      SendPmToAll(Bot, "\r\n"..contents.."\r\n|")
   else
      user:SendPM(Bot, "\r\n"..contents.."\r\n|")
   end
end
@ _XStaTiC_: %b captures strings between the 1st 2 chars which are after the b.
in your case it would be something between the [ and the U followed by SER.
all needed is 2 excape the [ from being magic, %[.

plop
Title:
Post by: gathering on 22 December, 2004, 09:46:34
don?t get it dosen?t work