pl:SetUserGroup not permanent


if (text == "!join") and pl:IsUserGroup("user") then 
			pl:PS_GivePoints(10000)
			pl:SetUserGroup( "patriot" )

The idea is that the player is new, so ULX automatically sets them to “user” group.
The player types “!join”
The player is rewarded 10000 points
The player is added to “patriot” group.

This ‘works’, but when one rejoins the server, they are no longer “patriot”- as if it didn’t save. So essentially the free 10,000 points can be spammed.

The only other ‘add user to group’ command that I know of, is the RCON command: “ulx adduser Sulli superadmin” (for instance).

Any thoughts?
Thanks

EDIT:
I know for a fact that this isn’t modifying my servers /settings/users.txt file (even the RCON command, but that is permanent until changed!)

The end goal is to have this as an automated system, so I don’t need to add each and every user into the “patriot” group manually, via ULX or other means!

You can’t do that without overriding the save system, unfortunately.

Is ulx saving any user group for any player? In example can you add yourself to a group and it be persistent?

Also, I am not sure if this would make much of a difference, but I myself never used ply:SetUserGroup(). Maybe try



if (text == "!join") and ply:IsUserGroup("user") then 
     ply:PS_GivePoints(10000)
     RunConsoleCommand("ulx", "adduser", ply:Nick(), "patriot")
end


EDIT:

This seems possible without going through so much work

Can one override it, easily? :stuck_out_tongue:

I don’t understand why that won’t save! I’m just trying to save myself from having to buy this: http://coderhire.com/browse/script/434/steam-group-rewards :stuck_out_tongue: WHAT DO THEY HAVE THAT I DON’T!? :’(

[editline]27th June 2014[/editline]

TOP MAN, thank you kindly!

Questions:
ply:Nick() – What does this REALLY mean? What is the “Nick” bit mean? Does that mean self? How does that choose between player Johnny and player Jack??

Also thanks for the pointer towards “RunConsoleCommand” that will come in handy!

Change
[lua]pl:SetUserGroup( “patriot” )[/lua]
to
[lua]ULib.ucl.addUser( pl:SteamID(), nil, nil, “patriot” )[/lua]

-ninja’d- but mine doesn’t show “CONSOLE has added PLAYERNAME to usergroup patriot”

Nick() gets the players name and returns it as a string: http://wiki.garrysmod.com/page/Player/Nick

It chooses between players based on the player entity you send to it, or in this case the player that types your !join command. ply:Nick() when PLY Is the player using the command. self and ply:Nick() are not that same in this case and self wouldn’t actually be applicable in this case