Ulx Ungag on reconnect

Ok lets face it, players often get forgotten about on the mute/gag list. I would like to make it so players get un-muted/un-gaggged on reconnect. ULX was set up like this by default years ago; I understand why they changed it but I’d rather have it set up like this.

Here is what I got:



hook.Add( "PlayerInitialSpawn", "RemoveRTDShitOnLoad", function(pl)
        pl:SetNWBool("ulx_gagged", should_ungag)
        pl:SetNWBool("ulx_muted", should_unmute)
end)


Thanks for any direction or input!

Are you sure about they keep being gaged/muted?

[editline]29th October 2013[/editline]

It’s set as a player variable as well: https://github.com/Nayruden/Ulysses/blob/master/ulx/lua/ulx/modules/sh/chat.lua#L225

Oops I have been looking at code for too long, I can’t believe that I missed that.

Still no luck, this is what I have now:



hook.Add( "PlayerInitialSpawn", "RemoveRTDShitOnLoad", function(pl)

	pl.ulx_gagged = should_ungag
        pl:SetNWBool("ulx_gagged", pl.ulx_gagged)

end)


I’m still not sure it persists. If it does it’s stored somewhere which isn’t on the player, since it would be lost on disconnect.

It persists on my servers. Can anyone else confirm this?

Only if you have some old version or some modified version. Currently its stored as a variable which would not persist between reconnects or map changes.

Why not use PData?

Is ‘should_ungag’ a placeholder or are you actually referencing it?

That’s referenced in the ULX gag command.

Hmmm I am a little curious to what is causing this. I am running a stock SVN version of ULX.

[editline]29th October 2013[/editline]

I kept my data folder from gmod11 because I was too lazy to set up ULX again. That must be whats causing it.

Should it be just…
[lua]
hook.Add( “PlayerInitialSpawn”, “RemoveRTDShitOnLoad”, function(pl)
pl.ulx_gagged = false
pl:SetNWBool(“ulx_gagged”, pl.ulx_gagged)
end)
[/lua]
… then?

Its fixed, thanks for the help everyone. A fresh SVN fixed it, even though it was the same revision as my old.