Ulysses Stuff > Releases

CenKik - Censoring and Kicking

<< < (6/11) > >>

Storm:
I tried this several different ways, including inside the if CenKik.censor. What am I doing wrong?? Sorry but I know nothing about coding!

local function Riplash( ply, text )
   local filter = text
   kikpls = nil
   CenKik.forcetext = nil
   for k,v in pairs( CenKik.words ) do
      if string.find( string.lower( filter ), v, 1, true ) then
         if CenKik.censor then
            filter = string.Explode( " ", filter )
            for a,b in pairs( filter ) do
               print( filter[k] )
               if string.find( string.lower( filter[a] ), v, 1, true ) then
                  local replace = string.rep( "*", string.len( v ) )
                  filter[a] = string.gsub( string.lower( filter[a] ), v, replace )
                  filter = string.Implode( " ", filter )
                  kikpls = true
               end
            end
            
         end   
         
         if string.find( string.lower( filter[a] ), v, 1, true ) then
                    local replace = string.rep( "*", string.len( v ) )
                    filter[a] = string.gsub( string.lower( filter[a] ), v, replace )
                    filter = string.Implode( " ", filter )
                    kikpls = true
                    for _, ad in pairs ( player.GetAll() ) do
                           if ad:IsAdmin() then
                                    ad:ChatPrint( ply:Nick() .. " attempted to say: " .. text )
                            end
                    end
            end         
      end
   end

LuaTenshi:
I think you are over complicating things a little why not just push text to asay? ulx.asay( nil, ply:Nick() .. " attempted to say: " .. text ) or ulx.asay( ply, text )

Decicus:

--- Quote from: LuaTenshi on January 17, 2014, 04:20:31 AM ---I think you are over complicating things a little why not just push text to asay? ulx.asay( nil, ply:Nick() .. " attempted to say: " .. text ) or ulx.asay( ply, text )

--- End quote ---
I haven't tried ulx.asay in a while, but last time I did, it didn't properly work for me. So I used the query code instead.


--- Quote from: Storm on January 17, 2014, 02:44:06 AM ---I tried this several different ways, including inside the if CenKik.censor. What am I doing wrong?? Sorry but I know nothing about coding!

--- Code: ---local function Riplash( ply, text )
local filter = text
kikpls = nil
CenKik.forcetext = nil
for k,v in pairs( CenKik.words ) do
if string.find( string.lower( filter ), v, 1, true ) then
if CenKik.censor then
filter = string.Explode( " ", filter )
for a,b in pairs( filter ) do
print( filter[k] )
if string.find( string.lower( filter[a] ), v, 1, true ) then
local replace = string.rep( "*", string.len( v ) )
filter[a] = string.gsub( string.lower( filter[a] ), v, replace )
filter = string.Implode( " ", filter )
kikpls = true
end
end

end

if string.find( string.lower( filter[a] ), v, 1, true ) then
                 local replace = string.rep( "*", string.len( v ) )
                 filter[a] = string.gsub( string.lower( filter[a] ), v, replace )
                 filter = string.Implode( " ", filter )
                 kikpls = true
                 for _, ad in pairs ( player.GetAll() ) do
                  if ad:IsAdmin() then
                           ad:ChatPrint( ply:Nick() .. " attempted to say: " .. text )
                      end
                 end
            end
end
end

--- End code ---

--- End quote ---
Hmm, I don't know, really. I don't have much time to test whatever code I give out. You could try what LuaTenshi said with ulx.asay, just replace my code with:

--- Code: ---ulx.asay( "CenKik", ply:Nick() .. " attempted to say: " .. text )
--- End code ---
That should work the same way, but the message will be sent through the "asay".

Neku:

--- Code: ---ulx.asay( nil, ply:Nick() .. " attempted to say: " .. text )
--- End code ---

Storm:
Thanks Neku! Exactly where do I put that code in your script? I would think any owner would want this in the script, you might consider adding it?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version