General > Developers Corner

Have a Gamemode Detect a ULX function?

(1/2) > >>

Zombine:
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: ---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)
--- End code ---

bender180:
You would have to modify the existing cloak command or write one yourself.

Zombine:
All right, I suppose I'll try that.

JamminR:

--- Quote from: bender180 on August 15, 2014, 04:11:21 PM ---You would have to modify the existing cloak command or write one yourself.

--- End quote ---
Nah, you don't.
You could use ULibCommandCalled or perhaps ULibPostTranslatedCommand to look for "ulx cloak" and run any function/code needed.

Zombine:
So then do you suppose I might be able to sneak this in there to have it run the rest of the code?


--- Code: ---if ply:ULibCommandCalled( ply, ULib.invisible ) ~= true
--- End code ---

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.

Navigation

[0] Message Index

[#] Next page

Go to full version