ULX

Author Topic: Checking if players are muted, gimped or frozen?  (Read 3285 times)

0 Members and 1 Guest are viewing this topic.

Offline Jonas Præstegaard

  • Newbie
  • *
  • Posts: 6
  • Karma: 3
Checking if players are muted, gimped or frozen?
« on: September 09, 2015, 09:45:55 PM »
Is there any way to check if a specific player has been muted, gimped, gagged, frozen etc.?

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Checking if players are muted, gimped or frozen?
« Reply #1 on: September 10, 2015, 10:04:33 AM »
Looks like it uses NWBool for each, so you can just use ply:GetNWBool("ulx_gagged", false) to check them.  Change the "gagged" part to check each one obviously.  That works for all the communication ones, but I'm not 100% sure on the frozen one.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Checking if players are muted, gimped or frozen?
« Reply #2 on: September 10, 2015, 03:10:04 PM »
<player object>:IsFrozen()

There are other ways to check the mute status too. variables when on server side that might be quicker lookup.
(I didn't look close enough to tell if they were local or global though, so nwbool is more likely)

"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Jonas Præstegaard

  • Newbie
  • *
  • Posts: 6
  • Karma: 3
Re: Checking if players are muted, gimped or frozen?
« Reply #3 on: September 27, 2015, 06:06:32 AM »
There must be some way of checking this. Also: the <object>:IsFrozen() doesn't work with ULX's freeze for some reason.
Any other input?

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Checking if players are muted, gimped or frozen?
« Reply #4 on: September 27, 2015, 06:57:14 AM »
Jonas, Yes, there is some way, Aaron's answer for the mute, gagged and gimped would be correct and safest way to determine.
If it's not working for you, you'd really need to show us a code example of how you're checking.

I'm also unsure why freeze isn't working for you, it's what we use in our own code.
« Last Edit: September 27, 2015, 07:19:02 AM by JamminR »
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Jonas Præstegaard

  • Newbie
  • *
  • Posts: 6
  • Karma: 3
Re: Checking if players are muted, gimped or frozen?
« Reply #5 on: September 29, 2015, 12:07:13 PM »
Thanks for the help lads. The NWBool worked perfectly.
I did encounter another strange problem though. I hope you might be able to help:

Code (clientside):

Code: [Select]
if tar:GetNWBool("ulx_gagged", true) then
print("Player was gagged!")
RunConsoleCommand("ULX","ungag",tar:Name())
else
print("Player was NOT gagged!")
RunConsoleCommand("ULX","gag",tar:Name())
end

Console output (after 3 tries - starting ungagged):

Code: [Select]
Player was NOT gagged!
ServerLog: [ULX] Fillipuster :D gagged Bot03
You gagged Bot03
Player was gagged!
ServerLog: [ULX] Fillipuster :D gagged Bot03
You gagged Bot03
Player was gagged!
ServerLog: [ULX] Fillipuster :D gagged Bot03
You gagged Bot03


For some reason it always gags the player, never ungags (even though the check returns gagged as true)...

Any help is appreciated :D

Offline Timmy

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 252
  • Karma: 168
  • Code monkey
Re: Checking if players are muted, gimped or frozen?
« Reply #6 on: September 29, 2015, 05:34:08 PM »
ULX does not seem to execute the opposite when you write the "ULX" in capitals. That might be a bug... or maybe we're not supposed to scream ULX in our consoles. D:

Code: [Select]
] ULX gag "Timmy"
You gagged Yourself
] ULX ungag "Timmy"
You gagged Yourself
] ulx ungag "Timmy"
You ungagged Yourself

Your script will work if you make the "ULX" in RunConsoleCommand lower-case.

« Last Edit: September 29, 2015, 06:06:04 PM by Timmy »

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: Checking if players are muted, gimped or frozen?
« Reply #7 on: September 29, 2015, 10:18:07 PM »
Well.. Hmm. That is an interesting bug- Nice find! I've got it fixed up here. :)
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Checking if players are muted, gimped or frozen?
« Reply #8 on: September 30, 2015, 01:34:47 AM »
I'm a little rusty right now with lua, but need some more details for :IsFrozen(). When you say it doesn't work, do you mean it literally doesn't work, nothing works, it gives you an error, or your code specifically doesn't work with it? IsFrozen is a boolean (if that is how you spell it, I forgot now). So it should be telling you true or false..
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline Jonas Præstegaard

  • Newbie
  • *
  • Posts: 6
  • Karma: 3
Re: Checking if players are muted, gimped or frozen?
« Reply #9 on: September 30, 2015, 04:09:47 AM »
@Everyone: Thanks a bunch! Strange bug indeed...

@Bit That Apple: I checked through my code and found that I did the check wrong. Obj:IsFrozen() does work with ULX's freeze.

Amazing support!

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Checking if players are muted, gimped or frozen?
« Reply #10 on: September 30, 2015, 03:03:33 PM »
Welcome. Glad you got it sorted out.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming