Ulysses Stuff > Releases

TempAdd (v2.4) - Add a user to another group for a set amount of time

(1/28) > >>

MrPresident:
Hello Everyone!

This is my first official module release for ULX since Garry's Mod 13.

This is in addon format. Drop the ULX_TempAddUser folder inside of the .zip file into your addons folder.
Temporarily add a user for a certain amount of time

Usage
ulx tempadduser <player> <group> <time(minutes)> <group>

player - Player name on server who you wish to temporarily promote
group - Group you wish to promote the user into
time - Time in minutes you wish the player to be in the group. NOTE: this is real time from when you run the command. NOT TIME PLAYED. (ex: 1440 would promote the player for 24 real-time hours)
group - The group the player should return to after their time is up. Set this to user if you wish the player to be the default user rank after.

ulx tempadduserid <steamid> <group> <time(minutes)> <group>

steamid - SteamID of the player you wish to temporarily promote.
group - Group you wish to promote the user into
time - Time in minutes you wish the player to be in the group. NOTE: this is real time from when you run the command. NOT TIME PLAYED. (ex: 1440 would promote the player for 24 real-time hours)
group - The group the player should return to after their time is up. Set this to user if you wish the player to be the default user rank after.


Please let me know if there are any bugs.


ChangeLog

Version: 2.4
+ Added the ability to add offline players using their steamid.
+ Fix for Linux compatibility. (Thanks fopje)
+ Possible fix for some of the issues some players have been having with groups not being reverted. Please let me know if this continues.

Version: 2.3
+ Fixed an issue where loading a player's existing temp data when joining a server was trying to compare a number with a string data. Opps!

Version: 2.2
+ Added some code (Thanks Stickly) that fixes the groups not showing up properly in the autocomplete.
+ Fixed the parameter hints to help users with XGUI
+ Hopefully fixed the bug that was showing up client-side displaying an error for IsConnected.

Version: 2.1
+ The script now checks all connected players every 30 minutes rather than setting a timer up to 24 hours on a connected player.
+ Cleaned up the code (removed a lot of debugging commented out code)
+ Commented the functions so users can see what is being done

Version: 2.0
+ Release

Megiddo:
Yay! Good to see you back here releasing things, Mr. P.

I reviewed your code just to see how you approached the problem, etc, and learned quite a bit about new API I hadn't noticed! Why did you choose to use SteamID64, exactly? I'm not around a computer that I can check what that outputs, unfortunately. And, Garry added libraries to support JSON, that's awesome!

Recommendation: You're currently creating a timer to expire access if they join and expire within 24 hours. Instead, create a timer that checks everyone's expirations every x minutes (say, 30), then create additional timers to expire them at that point. This is especially useful because I believe timers are based off game time, not real world time, so 24 hours will offer a lot of time for the clocks to get out of sync. (But I don't recall if this is definitely true or not.)

MrPresident:
SteamID64 which is new with GMod13 I believe uses a unique numeric identifier for the player.

Example:
STEAM_0:1:1234567

is

76561197962734863

This makes it so much easier to use a player's unique identifier in code and in save files without having to parse a normal SteamID to make it safe (IE: remove the colons, etc)


The idea for checking every xx minutes is great. I never thought of that.

You'll notice I decided not to use JSON. Turns out that JSON only supports normal signed integers and an EPOC time is much more than 32,786. Considering the file only stored 2 variables I figured a string delimiter was good enough.

SuperAero_:
TY :D

MrPresident:
***UPDATE***

Version: 2.1

ChangeLog:
+ The script now checks all connected players every 30 minutes rather than setting a timer up to 24 hours on a connected player.
+ Cleaned up the code (removed a lot of debugging commented out code)
+ Commented the functions so users can see what is being done

Navigation

[0] Message Index

[#] Next page

Go to full version