A simple command using ConCommand, allowing you to impersonate any player you want to (forcing the player to run "say <msg>"
This command does NOT change your name, just forces a player to say whatever you want him/her to, this command should not be used to do anything illegal, or advertise through other players.
This command alerts other admins who you impersonate through chat as well (silently)
SOURCE:
function ulx.impersonate( calling_ply, target_plys, msg )
if not msg:find("^!") then -- Allows messages only (not commands)
for k,v in pairs ( target_plys ) do
v:ConCommand("say " .. msg .. "\n") -- Sends the message
end
else
ULib.tsayError( calling_ply, "Do not force players to run commands", true )
end
ulx.fancyLogAdmin( calling_ply, true, "#A impersonated #T", target_plys ) -- For admins (silent)
end
local impersonate = ulx.command( "Tom's Fun", "ulx impersonate", ulx.impersonate, "!imp", true )
impersonate:addParam{ type=ULib.cmds.PlayersArg }
impersonate:addParam{ type=ULib.cmds.StringArg, hint="string" }
impersonate:addParam{ type=ULib.cmds.BoolArg, invisible=true }
impersonate:defaultAccess( ULib.ACCESS_SUPERADMIN )
impersonate:help( "Impersonates a player." ) -- End
USAGE: I recommend using console, or menu to run this command (located in Fun).
Menu: Fun > Impersonate > Player + MSG BEST OPTION
Console: ulx impersonate "<name>" "<msg>" SECOND OPTION
Chat: !imp "<name>" "<msg>" LAST OPTION
INSTALLATION:
Download == Extract the zip and the contents into /addons file (garrysmod/addons/), relaunch map, and its done.
Source == Copy the source code and paste it into a new .lua file in /sh file on ulx (garrysmod/addons/ulx/lua/ulx/modules/sh), relaunch map, and its done.
I am not responsible to any damage or inconvenience caused by this command.
(UPDATED) Fixed poor coding, and command filter.