[code]
function TalkToRange(msg, pos, size)
local ent = ents.FindInSphere(pos, size)
for k, v in pairs(ent) do
if v:IsPlayer() then
v:ChatPrint(msg)
// v:PrintMessage(2, msg)
end
end
end
--------------------------------------------------
---- REWRITING OF THE CLIENT CHAT FUNCTIONS ------
--------------------------------------------------
function GM:PlayerSay( ply, text, team, is_dead )
local name = ply:Name()
text = string.lower( text )
if ( string.sub( text, 1, 0 ) == "") then
text = string.Replace( "", text )
TalkToRange("[Local]: " .. ply:Name(), ply:GetPos(), 250)
if ( string.sub( text, 1, 2 ) == "//") then
text = string.Explode( " ", text )
TalkToRange("[OOC]: " .. ply:Name(), ply:GetPos(), 10000)
end
if ( string.sub( text, 1, 3 ) == ".//") then
text = string.Explode( " ", text )
TalkToRange("[LOOC]: " .. ply:Name(), ply:GetPos(), 250)
end
end
end
[/code]
So uh... Mind just sayin what the issue is? Because as it stands I don't know what you're trying to do, or anything.
Its not working because:
[lua]
if( string.sub( text, 1, 0 ) == "") then
[/lua]
string.sub will return a character .. and only returning "" if the text is empty.
[lua]
string.Replace( "", text )
[/lua]
Replace nothing with text .. this will replace every space between the letters with the given text.
Also why are you calling:
[lua]text = string.Explode( " ", text )[/lua]
So many times?
This will change the text into an array .. I see no point in that.
Sorry, you need to Log In to post a reply to this thread.