ULX

Author Topic: Have a Gamemode Detect a ULX function?  (Read 2504 times)

0 Members and 1 Guest are viewing this topic.

Offline Zombine

  • Newbie
  • *
  • Posts: 19
  • Karma: 0
Have a Gamemode Detect a ULX function?
« on: August 15, 2014, 03:52:02 PM »
Like the title says. Say I'm in DarkRP, and I'd like the gamemode to run a certain feature if the user is cloaked.
Specifically, if the user is cloaked, it will hide the name and job tag above their head.
Is this at all possible?

I have some code someone gave me to hide the tags if the player is using a certain job, but I'm unsure if it can be made to interact with ULX.

Code: [Select]
hook.Add("HUDShouldDraw","DarkRP_HideJobsEntityDisplay",function(hudName)
   if hudName ~="DarkRP_EntityDisplay"thenreturnend

   local playersToDraw ={}
   for _,ply inpairs(player.GetAll())do
       if ply:Team()~= TEAM_SOMEJOB then
           table.insert(playersToDraw, ply)
       end
   end
   returntrue, playersToDraw
end)

Offline bender180

  • Full Member
  • ***
  • Posts: 217
  • Karma: 42
    • Benders Villa
Re: Have a Gamemode Detect a ULX function?
« Reply #1 on: August 15, 2014, 04:11:21 PM »
You would have to modify the existing cloak command or write one yourself.
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 Zombine

  • Newbie
  • *
  • Posts: 19
  • Karma: 0
Re: Have a Gamemode Detect a ULX function?
« Reply #2 on: August 15, 2014, 04:12:38 PM »
All right, I suppose I'll try that.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Have a Gamemode Detect a ULX function?
« Reply #3 on: August 15, 2014, 07:52:56 PM »
You would have to modify the existing cloak command or write one yourself.
Nah, you don't.
You could use ULibCommandCalled or perhaps ULibPostTranslatedCommand to look for "ulx cloak" and run any function/code needed.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Zombine

  • Newbie
  • *
  • Posts: 19
  • Karma: 0
Re: Have a Gamemode Detect a ULX function?
« Reply #4 on: August 16, 2014, 11:54:40 AM »
So then do you suppose I might be able to sneak this in there to have it run the rest of the code?

Code: [Select]
if ply:ULibCommandCalled( ply, ULib.invisible ) ~= true
I'm about 99.99% sure that won't work, because I am terrible with lua, but thank you anyway JamminR. I'll go experiment.

Offline Cobalt

  • Full Member
  • ***
  • Posts: 216
  • Karma: 44
  • http://steamcommunity.com/id/__yvl/
Re: Have a Gamemode Detect a ULX function?
« Reply #5 on: August 16, 2014, 01:15:58 PM »
if ply:GetMaterial() == "models/effects/vol_light001" then ...

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given