Ulysses

Ulysses Stuff => Releases => Topic started by: Tomzen on May 06, 2015, 09:23:11 PM

Title: [ULX] [UPDATED/FIXED] Impersonate ~ Impersonate a player in chat!
Post by: Tomzen on May 06, 2015, 09:23:11 PM
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:
Code: [Select]
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.
Title: Re: [ULX] Impersonate ~ Impersonate a player in chat!
Post by: Bite That Apple on May 06, 2015, 09:41:33 PM
Reminds me of ulx cexec
Title: Re: [ULX] Impersonate ~ Impersonate a player in chat!
Post by: Tomzen on May 06, 2015, 10:23:21 PM
Reminds me of ulx cexec

Pretty much what it is, but I was bored, and this makes it easier to troll my friends :)
Title: Re: [ULX] Impersonate ~ Impersonate a player in chat!
Post by: Timmy on May 06, 2015, 10:30:58 PM
I never thought about impersonating my friends but now... This is gonna be fun. :3

Also ulx.command can take a 5th argument, true or false. Setting it to true will hide the command in chat.
Title: Re: [ULX] Impersonate ~ Impersonate a player in chat!
Post by: Tomzen on May 06, 2015, 10:58:08 PM
I never thought about impersonating my friends but now... This is gonna be fun. :3

Also ulx.command can take a 5th argument, true or false. Setting it to true will hide the command in chat.

Thanks, forgot about that. Updated.
Title: Re: [ULX] Impersonate ~ Impersonate a player in chat!
Post by: allofmywutsteam on May 07, 2015, 10:36:45 AM
similar to ulx imitate i believe right? by bender's ulx commands
Title: Re: [ULX] Impersonate ~ Impersonate a player in chat!
Post by: Tomzen on May 07, 2015, 08:41:24 PM
similar to ulx imitate i believe right? by bender's ulx commands

Never realised Bender180 released that... wow, I guess I'll have a look :/
Title: Re: [ULX] Impersonate ~ Impersonate a player in chat!
Post by: bender180 on May 09, 2015, 02:30:10 PM
Never realised Bender180 released that... wow, I guess I'll have a look :/

I dont remember releasing that.... I may have... but i dont remember. None the less good job!
Title: Re: [ULX] Impersonate ~ Impersonate a player in chat!
Post by: allofmywutsteam on May 09, 2015, 02:52:25 PM
Actually you're right. I'm not sure where I got it from then.
Title: Re: [ULX] [UPDATED/FIXED] Impersonate ~ Impersonate a player in chat!
Post by: Tomzen on May 17, 2015, 02:01:37 AM
(FIX) Added command filter, allowing only messages to go through and NOT commands (or anything starting with "!" really)