Author Topic: [ULX] [UPDATED/FIXED] Impersonate ~ Impersonate a player in chat!  (Read 11121 times)

0 Members and 1 Guest are viewing this topic.

Offline Tomzen

  • Full Member
  • ***
  • Posts: 115
  • Karma: -1
  • A new lua adventurer
    • Thirdage Gaming
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.
« Last Edit: May 17, 2015, 02:02:41 AM by Tomzen »
Finished:
Impersonate
<==> FakePromote/Demote <==> RandomMap <==> ForceMic <==> Search <==> PlayMenu <==
WIP:
ServerMode <==

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: [ULX] Impersonate ~ Impersonate a player in chat!
« Reply #1 on: May 06, 2015, 09:41:33 PM »
Reminds me of ulx cexec
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline Tomzen

  • Full Member
  • ***
  • Posts: 115
  • Karma: -1
  • A new lua adventurer
    • Thirdage Gaming
Re: [ULX] Impersonate ~ Impersonate a player in chat!
« Reply #2 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 :)
Finished:
Impersonate
<==> FakePromote/Demote <==> RandomMap <==> ForceMic <==> Search <==> PlayMenu <==
WIP:
ServerMode <==

Offline Timmy

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 252
  • Karma: 168
  • Code monkey
Re: [ULX] Impersonate ~ Impersonate a player in chat!
« Reply #3 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.

Offline Tomzen

  • Full Member
  • ***
  • Posts: 115
  • Karma: -1
  • A new lua adventurer
    • Thirdage Gaming
Re: [ULX] Impersonate ~ Impersonate a player in chat!
« Reply #4 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.
Finished:
Impersonate
<==> FakePromote/Demote <==> RandomMap <==> ForceMic <==> Search <==> PlayMenu <==
WIP:
ServerMode <==

Offline allofmywutsteam

  • Full Member
  • ***
  • Posts: 136
  • Karma: 3
  • MNWO Owner
    • MNWO Discord
Re: [ULX] Impersonate ~ Impersonate a player in chat!
« Reply #5 on: May 07, 2015, 10:36:45 AM »
similar to ulx imitate i believe right? by bender's ulx commands
"Then Jesus said to his disciples, 'Whoever wants to be my disciple must deny themselves and take up their cross and follow me.'" - Matthew 16:24



MNWO: Steam | Discord | Website | Join Server

Offline Tomzen

  • Full Member
  • ***
  • Posts: 115
  • Karma: -1
  • A new lua adventurer
    • Thirdage Gaming
Re: [ULX] Impersonate ~ Impersonate a player in chat!
« Reply #6 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 :/
Finished:
Impersonate
<==> FakePromote/Demote <==> RandomMap <==> ForceMic <==> Search <==> PlayMenu <==
WIP:
ServerMode <==

Offline bender180

  • Full Member
  • ***
  • Posts: 217
  • Karma: 42
    • Benders Villa
Re: [ULX] Impersonate ~ Impersonate a player in chat!
« Reply #7 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!
Made community pool and community bowling and for the life of me couldn't tell you why they are popular.
Also made the ttt ulx commands.

Offline allofmywutsteam

  • Full Member
  • ***
  • Posts: 136
  • Karma: 3
  • MNWO Owner
    • MNWO Discord
Re: [ULX] Impersonate ~ Impersonate a player in chat!
« Reply #8 on: May 09, 2015, 02:52:25 PM »
Actually you're right. I'm not sure where I got it from then.
"Then Jesus said to his disciples, 'Whoever wants to be my disciple must deny themselves and take up their cross and follow me.'" - Matthew 16:24



MNWO: Steam | Discord | Website | Join Server

Offline Tomzen

  • Full Member
  • ***
  • Posts: 115
  • Karma: -1
  • A new lua adventurer
    • Thirdage Gaming
Re: [ULX] [UPDATED/FIXED] Impersonate ~ Impersonate a player in chat!
« Reply #9 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)
Finished:
Impersonate
<==> FakePromote/Demote <==> RandomMap <==> ForceMic <==> Search <==> PlayMenu <==
WIP:
ServerMode <==