Ulysses

General => Developers Corner => Topic started by: Jonas Præstegaard on September 09, 2015, 09:45:55 PM

Title: Checking if players are muted, gimped or frozen?
Post by: Jonas Præstegaard 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.?
Title: Re: Checking if players are muted, gimped or frozen?
Post by: Aaron113 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.
Title: Re: Checking if players are muted, gimped or frozen?
Post by: JamminR 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)

Title: Re: Checking if players are muted, gimped or frozen?
Post by: Jonas Præstegaard 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?
Title: Re: Checking if players are muted, gimped or frozen?
Post by: JamminR 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.
Title: Re: Checking if players are muted, gimped or frozen?
Post by: Jonas Præstegaard 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
Title: Re: Checking if players are muted, gimped or frozen?
Post by: Timmy 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.

Title: Re: Checking if players are muted, gimped or frozen?
Post by: Stickly Man! on September 29, 2015, 10:18:07 PM
Well.. Hmm. That is an interesting bug- Nice find! I've got it fixed up here. (https://github.com/Nayruden/Ulysses/commit/414bfc7fa6769e095bf788ca5685dbd1736b7156) :)
Title: Re: Checking if players are muted, gimped or frozen?
Post by: Bite That Apple 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..
Title: Re: Checking if players are muted, gimped or frozen?
Post by: Jonas Præstegaard 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!
Title: Re: Checking if players are muted, gimped or frozen?
Post by: JamminR on September 30, 2015, 03:03:33 PM
Welcome. Glad you got it sorted out.