• Print

Author Topic: Gag & mute.  (Read 5741 times)

0 Members and 1 Guest are viewing this topic.

Offline Spider

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Gag & mute.
« on: June 18, 2013, 10:44:48 am »
I need a command that gags AND mutes the player with one command. I'm new to coding ulx, and this is what I came up with and it failed horribly.

Quote
function ulx.mute2( calling_ply, target_plys )
   local affected_plys = {}

   for i=1, #target_plys do
      local v = target_plys[ i ]
      v:ConCommand:("ulx gag")
      v:ConCommand:("ulx mute")
   

   ulx.fancyLogAdmin( calling_ply, "#A gagged and muted #T!", command, target_plys )
end
local mute2= ulx.command( "Zero's Commands", "ulx mute2", ulx.mute2, "!mute2" )
mute2:defaultAccess( ULib.ACCESS_SUPERADMIN )
mute2:help( "Gags and mutes the target." )

My main problem is how to get the v:ConCommand("ulx gag") to target someone.
« Last Edit: June 18, 2013, 10:47:47 am by Spider »

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Gag & mute.
« Reply #1 on: June 18, 2013, 12:41:18 pm »
Try
Code: Lua
  1. calling_ply:ConCommand( "ulx gag $" .. v:UniqueID() )

The '$' is part of the targeting system to target by player ID. Also, you're missing an end at the end of the for loop.
Experiencing God's grace one day at a time.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Gag & mute.
« Reply #2 on: June 18, 2013, 03:53:03 pm »
Heck, he's missing the target parameter in creation of the ulx command object.
Spider, see the [new stuff here] section of /index.php/topic,4464.0.html#msg17838 />
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

  • Print