Author Topic: 2 Command Requests  (Read 1426 times)

0 Members and 1 Guest are viewing this topic.

Offline howzy

  • Newbie
  • *
  • Posts: 6
  • Karma: -1
2 Command Requests
« on: January 20, 2016, 01:29:43 AM »
I am looking for 2 command codes. First command is !steamid

SteamID: The command to copy someones in game steamid. EG: Open ulx menu, then open a category, then there would be a command that is called SteamID. When you highlight someones name and click the ulc steamid button, it silently copies there steamid.

Second command is !fmotd

ForceMOTD: The command is for the poeple who join the server, close the motd without reading it, then break a rule. The FMOTD command will be so I and others of my server can use it for those type of people, when they break a rule. The Admins can make/ force them to read it. The MOTD pops up like when you first join the server, but I will be able to force them whenever I need.

Please post these commands in the 'code' thingy, so its easier to copy and read, thankyou!

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8032
  • Karma: 383
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: 2 Command Requests
« Reply #1 on: January 20, 2016, 08:42:09 AM »
From game console as admin, superadmin
ulx who
If proper admin, I'm pretty sure Steam IDs are shown.

as for force motd
ulx cexec <name of player> "ulx motd"
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Bytewave

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 723
  • Karma: 116
  • :)
    • My Homepage
Re: 2 Command Requests
« Reply #2 on: January 20, 2016, 12:32:04 PM »
If copying it from "status" or "ulx who" is... how can i say this without sounding passive-aggressive? too slow, you can always use this.

Code: Lua
  1. --[[-------
  2. ULX SteamID, by Bytewave
  3.  
  4. Usage:
  5.         ulx steamid <player>
  6.         !steamid <player>
  7.  
  8. Copies the given player's SteamID to the calling player's clipboard, or echos it to console if the caller is the host console.
  9. -------]]--
  10.  
  11. function ulx.steamid(calling_ply, target_ply)
  12.         if IsValid(target_ply) then
  13.                 if IsValid(calling_ply) then -- player
  14.                         SetClipboardText(target_ply:SteamID())
  15.                         ULib.tsay("[ULX SteamID] Successfully copied!")
  16.                 else -- server console
  17.                         MsgC(Color(0, 255, 0), "[ULX SteamID] SteamID for " .. target_ply:Name() .. ": " .. target_ply:SteamID())
  18.                 end
  19.         else -- error - target_ply is not a player
  20.                 if IsValid(calling_ply) then -- player
  21.                         ULib.tsayError(calling_ply, "[ULX SteamID] Failed to obtain a valid Player object. Disconnected?")
  22.                 else -- server console
  23.                         MsgC(Color(255, 0, 0), "[ULX SteamID] Failed to obtain a valid Player object. Disconnected?")
  24.                 end
  25.         end
  26. end
  27.  
  28. local steamid = ulx.command("Utility", "ulx steamid", ulx.steamid, "!steamid")
  29. steamid:addParam{type = Ulib.cmds.PlayerArg}
  30. steamid:defaultAccess(ULib.ACCESS_ALL)
  31. steamid:help("Copies the given player's SteamID to the calling player's clipboard, or echos it to console if the caller is the host console.")

This is untested, but it ought to work. If there are any errors, let me know. This was programmed in the middle of Latin on my school laptop, so don't expect perfection. :)

EDIT: This is why I don't code in the middle of school.
« Last Edit: February 02, 2016, 10:03:44 AM by Bytewave »
bw81@ulysses-forums ~ % whoami
Homepage