ULX

Recent Posts

Pages: [1] 2 3 ... 10
1
News / Re: Community Discord Server
« Last post by iViscosity on Yesterday at 09:53:18 PM »
Edit: holy moly that picture was big. Here's a smaller one:



Definitely haven't had one for a while ;) (If you can't read it, it's August 4 of 2016)

Also I'm gonna try to be active in there because I think Discord is easier than forums, so just @ me (@iViscosity#0001) if you need some help in either of the support/questions channels :)
2
Off-Topic / Re: Facepunch Archive Search?
« Last post by iViscosity on Yesterday at 09:46:44 PM »
That is really cool. Some very useful things on that site. I'd be interested in something like that.
3
Developers Corner / Re: STEAMID Targeting in Same Command
« Last post by JamminR on July 14, 2019, 09:52:34 PM »
I'm not MrP, but I can answer.
In your function, you setup target variable, target_player, but later reference only target_ply
4
Developers Corner / Re: STEAMID Targeting in Same Command
« Last post by Rice Cooker on July 14, 2019, 06:59:44 PM »
Thanks Again MrPresident!

The example is outputting an error.
This error being : bad argument #1 to 'upper' (string expected, got nil)

 Would you happen to know what might be able to fix this

Example command:
Code: [Select]
local CATEGORY_NAME = "TEST"

function ulx.test_command( calling_ply, target_player )

local ply = nil
if player.GetBySteamID( target_ply ) then ply = player.GetBySteamID( target_ply ) end
if ULib.getUser( target_ply ) then ply = ULib.getUser( target_ply ) end

if IsValid( ply ) then
target_ply:SendLua([[RunConsoleCommand("retry")]])
ulx.fancyLogAdmin( calling_ply, "#A has reconnected #T", target_ply )
else
ULib.tsayError( calling_ply, "ERROR.", true )
end

end
local test_command = ulx.command( CATEGORY_NAME, "ulx test", ulx.test_command, "!testcommand" )
test_command:addParam{ type=ULib.cmds.StringArg, hint="Player Name or SteamID", ULib.cmds.takeRestOfLine }
test_command:defaultAccess( ULib.ACCESS_ADMIN )
test_command:help( "Test Command" )
5
News / Community Discord Server
« Last post by MrPresident on July 13, 2019, 10:34:41 AM »
Hey everyone! I am pleased to announce that we have a discord server!

Feel free to hop on and talk with us about anything!

You can also use this space to get help with ULX or even provide help to other users who might be having problems if you so choose!

I look forward to seeing you there!

https://discord.gg/gR4Uye6
6
Developers Corner / Re: STEAMID Targeting in Same Command
« Last post by MrPresident on July 13, 2019, 09:58:45 AM »
This is rough.. and untested.. but it should work. you'll just need to edit it to your liking.

The way I told you to do it would work.. but this way would be better. There is a function in gmod called player.GetBySteamID that will work better than looping through the players checking their IDs. :)

Code: [Select]
local CATEGORY_NAME = "Fun"

function ulx.test_command( calling_ply, target_player )

local ply = nil
if player.GetBySteamID( target_player ) then ply = player.GetBySteamID( target_player ) end
if ULib.getUser( target_player ) then ply = ULib.getUser( target_player )

if IsValid( ply ) then
--Do some things here. ply is the player object of the player we found either by steamid or name
else
--Do some things here. No player found either by steamid or name
end

end
local test_command = ulx.command( CATEGORY_NAME, "ulx test", ulx.test_command, "!testcommand" )
test_command:addParam{ type=ULib.cmds.StringArg, hint="Player Name or SteamID", ULib.cmds.takeRestOfLine }
test_command:defaultAccess( ULib.ACCESS_ADMIN )
test_command:help( "Test Command" )
7
Developers Corner / Re: STEAMID Targeting in Same Command
« Last post by Rice Cooker on July 13, 2019, 01:06:34 AM »
Thanks MrPresident!

Would you be able to provide an example? I don't know how I would format the command function. I understand the fundamentals of how the command would work but some things like ( calling_ply, steamid, minutes, reason ) formatting have me a bit confused.

8
Developers Corner / Re: STEAMID Targeting in Same Command
« Last post by MrPresident on July 11, 2019, 06:26:07 PM »
You could absolutely do this.

The say you would do it is in your parameters where you accept the player (name/id) have that just expect a string.

Inside of your function, do a string.left on the string to search for "STEAM_" to determine if the info given is a steam id.

If it is not, assume player name and use ULib.getUser("playername") to return the user for that player.
If it is... you could iterate through the list of online players to see if any of their steamid's match the given steamid.

for k, v in pairs( player.GetAll() ) do
  if v:SteamID() == passed_name_or_id then
    v:DoThings()
    break
  end
end

Let me know if you need more help with this.
9
Developers Corner / STEAMID Targeting in Same Command
« Last post by Rice Cooker on July 11, 2019, 12:39:57 AM »
What I am wondering right now is there a way to have a command have then option to target someone in game through their name or through their STEAMID without creating a separate command for the STEAMID targeting.

Ex:
Command: Jail
Targeting: Name Or STEAMID
Result: If the person is online then they are jail. If not tsayerror notify player is not found.

Thanks!

10
Off-Topic / Re: Facepunch Archive Search?
« Last post by Timmy on July 06, 2019, 11:13:27 PM »
Sorry, I didn't realize Cubeupload had such a bad reputation. I will host the preview on my GitHub Pages instead.
Pages: [1] 2 3 ... 10