General > Developers Corner
ULX - SteamID to clipboard
MrPresident:
So try..
calling_ply:SendLua("LocalPlayer():SetClipboardText( target_ply:SteamID() )")
Cobalt:
--- Quote from: MrPresident on March 14, 2014, 09:37:05 PM ---So try..
calling_ply:SendLua("LocalPlayer():SetClipboardText( target_ply:SteamID() )")
--- End quote ---
You don't need LocalPlayer() for that.
MrPresident:
Ahh, yeah. Indeed you don't. I just took his 'server side' code and made it 'client side' verbatim.
You would need this:
--- Code: ---calling_ply:SendLua("SetClipboardText( target_ply:SteamID() )")
--- End code ---
Snell:
Firstly, Thank you MrPresident for the SendLua (I tested it and worked with a basic string)
This is my current code, and apparently the Universe Explodes if these 2 functions a put together. (I tested the 2 seperately)
http://pastebin.com/hdcCe4C0
--- Code: ----- Copies Target's SteamID to Clipboard
function ulx.steam_id ( calling_ply, target_ply )
local steamid = tostring ( target_ply:SteamID() )
calling_ply:SendLua( " SetClipboardText ( " .. steamid .. " ) " )
-- calling_ply:SendLua( " SetClipboardText ( 'taco' ) " ) -- Sets Clipboard to Taco, works and tested
-- Prints targets SteamID to console (works and tested)
Msg ( steamid )
ulx.fancyLogAdmin ( calling_ply, true, "#A's clipboard consist of #T's SteamID", target_ply )
end
local steam_id = ulx.command ( CATEGORY_NAME, "ulx id", ulx.steam_id, "!id" )
steam_id:addParam { type = ULib.cmds.PlayerArg }
steam_id:defaultAccess ( ULib.ACCESS_ALL )
steam_id:help ( "Copies the Target's SteamID to Clipboard." )
--- End code ---
Console and Server Error
--- Code: ---[ERROR] LuaCmd:1: '<name>' expected near '0'
1. unknown - LuaCmd:0
--- End code ---
I fixed (with a friend) this to my knowledge and it works, so thank you for you help.
Navigation
[0] Message Index
[*] Previous page
Go to full version