Hey guys, I made this plugin which should correct all pharses, adding uppercases and full stops.
The problem is that it adds full stops on commands too, and this is a problem. Can anyone help me with it? Thanks in advance.
[CODE]if (SERVER) then
local FilterWords = {
i = "I",
u = "you",
cuz = "because",
r = "are",
im = "I'm",
ur = "your",
omg = "oh my gosh",
omfg = "oh my freakin gosh",
ass = "butt",
wtf = "what the fudge",
tbh = "to be honest",
usa = "United States of America",
wont = "won't",
dont = "don't",
cant = "can't",
theyre = "they're",
}
function WhenPlayerSaysSomethingNoobish( PLAYER, Text )
local RetText = " "..string.lower( Text ).." "
for K, V in pairs( FilterWords ) do
RetText = string.Replace( RetText, " "..K.." ", " "..V.." " )
end
RetText = string.Trim( RetText )
local UpperText = string.upper( string.sub( RetText, 0, 1 ) )
RetText = UpperText..""..string.sub( RetText, 2, string.len( RetText ) )
if not string.find( string.sub( RetText, string.len( RetText ) ), "%p" ) then
RetText = RetText.."."
end
return RetText
end
hook.Add( "PlayerSay", "WhenPlayerSaysSomethingNoobish", WhenPlayerSaysSomethingNoobish)
end
if (CLIENT) then
end[/CODE]
[QUOTE=Liota;43667772]Hey guys, I made this plugin which should correct all pharses, adding uppercases and full stops.
The problem is that it adds full stops on commands too, and this is a problem. Can anyone help me with it? Thanks in advance.
[CODE]if (SERVER) then
local FilterWords = {
i = "I",
u = "you",
cuz = "because",
r = "are",
im = "I'm",
ur = "your",
omg = "oh my gosh",
omfg = "oh my freakin gosh",
ass = "butt",
wtf = "what the fudge",
tbh = "to be honest",
usa = "United States of America",
wont = "won't",
dont = "don't",
cant = "can't",
theyre = "they're",
}
function WhenPlayerSaysSomethingNoobish( PLAYER, Text )
local RetText = " "..string.lower( Text ).." "
for K, V in pairs( FilterWords ) do
RetText = string.Replace( RetText, " "..K.." ", " "..V.." " )
end
RetText = string.Trim( RetText )
local UpperText = string.upper( string.sub( RetText, 0, 1 ) )
RetText = UpperText..""..string.sub( RetText, 2, string.len( RetText ) )
if not string.find( string.sub( RetText, string.len( RetText ) ), "%p" ) then
RetText = RetText.."."
end
return RetText
end
hook.Add( "PlayerSay", "WhenPlayerSaysSomethingNoobish", WhenPlayerSaysSomethingNoobish)
end
if (CLIENT) then
end[/CODE][/QUOTE]
if your commands are in the form !command:
if ( if first character is ! ) then
add .
end
Sorry, you need to Log In to post a reply to this thread.