• /me for darkrp
    4 replies, posted
Hey there. can anybody make a command for /me in chat, like the one in the steam chat browser? or does it exist? i need one for my rp server. yes i know i could use ULX, but i prefer assmod.
[lua] function playerSaid(ply, text) if (string.sub(text, 1, 3) == "/me") then for k, v in pairs(player.GetAll()) do local mestring = string.sub(text, 4) v:SendLua('chat.AddText(team.GetColor(('..ply:Team()..')), "'..ply:Nick()..'", Color(255, 255, 255, 0), ": '..mestring..'")') end return "" end end hook.Add("PlayerSay", "playerSaid", playerSaid) [/lua] Stick it in lua/autorun/server/mesay.lua or something.
cheers edit: just got gmod working again and tested, it doesnt work right, it says dolphinlover: likes pie for example, i wanna get rid of the 2 dots (whatever theyre called
Just edit the code a bit ... [lua] function playerSaid(ply, text) if (string.sub(text, 1, 3) == "/me") then for k, v in pairs(player.GetAll()) do local mestring = string.sub(text, 4) v:SendLua('chat.AddText(team.GetColor(('..ply:Team()..')), "'..ply:Nick()..'", Color(255, 255, 255, 0), " '..mestring..'")') end return "" end end hook.Add("PlayerSay", "playerSaid", playerSaid) [/lua] [editline]11:59AM[/editline] Wtf, rated dumb a sec after I posted this, altough this should do the job ...
Don't worry about it, there's just a few bots rating every post dumb. :p
Sorry, you need to Log In to post a reply to this thread.