Ulysses
Ulysses Stuff => Ulysses Release Archives => Releases => Releases for ULib v1.* => Topic started by: mblunk on November 11, 2006, 04:23:13 PM
-
While my friend (DeltaOps101) and I were messing around on my server, we had an idea. Instead of the normal blind, the ability to place the kitten overlay on someone's screen. Simply add the following code to the bottom of ulx/fun.lua, then use these commands:
say !kittens <user> [time] -- Puts the overlay on the user for [time] seconds (If no time, default is 10)
console ulx kittens <user> [time] -- Same args as above
And for the code:
function ulx.cc_kittens( userid, args, argv, argc )
if argc < 1 then
ULib.tsay( userid, ulx.LOW_ARGS )
return
end
local amt
if not argv[ 2 ] then
amt = 10
else
amt = tonumber( argv[ 2 ] )
end
if not amt then
ULib.tsay( userid, "\"" .. argv[ 2 ] .. "\" is an invalid amount!" )
return
end
local targets, err = ULib.getUsers( argv[ 1 ], _, true, ulx.ucl, userid ) -- Enable keywords
if not targets then
ULib.tsay( userid, err )
return
end
for _, v in ipairs( targets ) do
ULib.sendRect( v, 301, 0, 0, 1, 1, amt, 255, 255, 255, 255, "matsys_regressiontest/background.vmt")
end
end
ulx.CONCOMMAND( "kittens", ulx.cc_kittens, "<user> [<time> - LOL KITTIES", ACCESS_SLAY, "!kittens" )
-
Mblunk, nice addition, though I've not ever used/seen this before.
One suggestion for the future for anyone coding addons (and until we make a modules folder)...
Try not to modify any of the original ULib/ULX files.
This way, when we have released newer versions, your code changes will not have gotten overwritten because you modified an original file. :)
To create your own, create your code in a separate .lua file in your \gmod9\lua\init folder
(Ulib_kitties.lua perhaps),
and at the top of your code, add the following...
assert( _file.Exists( "lua/ULib/init.lua" ), "ULX needs ULib to run!" )
_OpenScript( "ULib/init.lua" )
assert( ULib.ULIB_VERSION >= 1.1, "ULX requires ULib version 1.1 or higher to run!" )
You can change that version check if needed.
-
Ah yes, that makes more sense. I see how an update would cause loss of this feature. Thanks for the heads-up.