GetNWString("usergroup") returns nothing

Am running a darkrp server where am using ulx and fadmin both, I have recently noticed that for some players, their Networked string “usergroup” contains nothing I have also tried to set it manually in the server console but when I print it I got nothing. I don’t know if this problem is coming from user side or server side.

How are you trying to get the string

I just type this in the server console : lua_run print(player.GetByID(X):GetNWString(“usergroup”)) and it prints nothing.

I did that because some of my donators cannot access vip jobs, it was telling them that hey don’t have the rank but they do and in the customcheck I check the user group by using GetNWString(“usergroup”).

[editline]30th August 2014[/editline]

I also tried this:

player.GetByID(X):SetNWString("usergroup", "vip")
print(player.GetByID(X):GetNWString("usergroup")) -- I got nothing !

I have this issue only with some vips not all.

I would recommend looking at this, and making sure your mods are configured properly (ulx).

If you’re really curious about getting everyone’s usergroup, you can lua_run_cl this:

for _, v in pairs (player.GetAll()) do
print(v:Nick().." "..v:GetNWString("usergroup"))

Everything is configured correctly as far as I know.
The thing that I can’t understand is the fact that I got vips that are able to choose vip jobs but other vips and they are few can’t choose the vip job.
When I access to the NWString Fot those with no problem I got the usergroup but for others that can’t choose job i got nothing.

Paste an example of your customcheck function for your jobs.

Ok here is an exemple :
customCheck = function(ply) return ply:GetNWString(“usergroup”) == “vip” end

If you’re using ULX to set ranks use

ply:GetUserGroup() == "donator"

Certain VIPs might be set to vip in FAdmin, allowing them to use it. I don’t know if ULX sets an NWString for usergroups.

It’s UserGroup, not usergroup but you shouldn’t be doing GetNWString anyways.

[editline]29th August 2014[/editline]

There’s also

Pretty sure GetUserGroup just returns the nwstring…

[editline]30th August 2014[/editline]

Not sure what you’re trying to do here, but getting the user group and comparing it to another will not set it :v:

its not “usergroup”

its “UserGroup”

I’m literally reading right off of what it says in the first link I posted. It’s not my fault there’s 4 different ways to set someone’s “usergroup” because nobody can agree on a standard.

Bottom line is the OP should just use

customCheck = function(ply) return ply:GetUserGroup() == "vip" end,

and it should work. If it doesn’t, then there’s a different problem.

I am now using GetUserGroup() instead of GetNWString(“usergroup”) and it work just fine.
But still can’t understand why GetNWString(“usergroup”) is not returning the usergroup for some players.

Thank you.

Are you sure they have a group set up? Here’s an example of what I do ( in tutorials since I don’t use NW vars anylonger because they continuously re-query ):

Hopefully these tutorials and information helps. As always, to view the Lua from any of my tutorials to enable copy/pasting ( HTML doesn’t copy/paste well in terms of HTML / CSS Highlighted Lua ), remove .html from the url.

So, I grab the value, then cache the value, ensure I keep it for a minimum of 5 seconds before allowing it to requery. But, if you’re notice, I use || “guest” so that if the user doesn’t have a group, it is set to something “default”.

Because it’s Player:GetNWString(“UserGroup”)

The second arg is the default group to use if the result doesn’t exist. e.g “user”

This guy already said this like 3 posts above me, too.

You can see so yourself.

It should be GetNWString instead of GetNetworkedString unless they both do the same thing ( which the name suggests it should, but I’ve seen things named similarly that did different things )…

Will you stop giving a generic ‘tutorial’ to fix a very specific issue? It really doesn’t help, you need to start helping people on a case per case if you want it to have any effect.

Metaphor: Someone wants to know how to change a fuse, And you just gave them the whole manual for the entire car. Be more specific…

They do the same thing.

It does what the OP wants it to do, but better ( by caching the result instead of requerying each time ), it also sets and returns a default if no group is set. It can compare if in a certain group, or if the user is in a list of groups.

I agree 100%
Acecool evreytime I read your comments I understand NOTHING.
Only 5% of those ‘tutorials’ actually help.
I’ll use dingusnin’s example:
You give them the whole manual, and usually that’s fine, but when the fuse is on page 400 and they don’t know that, it’s just useless…

Also, having _ before every single variable is just confusing for new lua coders