General > Developers Corner
ULX Chat Coding Problem. Help!
MrPresident:
It literally only took a couple of lines of code to achieve this. Did you bother to even look at it to see if you could figure it out on your own? I understand not everyone can be masters of lua, but simple modifications should be within the capacity of understanding for anyone who wishes to run a decent server.
This is not a personal attack, but if you want to run a decent gmod server I highly highly suggest you learn some basic lua so that you can at a very minimum be able to modify and fix code that you find or download from other sources.
--- Code: ---local seeasayAccess = "ulx seeasay"
if SERVER then ULib.ucl.registerAccess( seeasayAccess, ULib.ACCESS_OPERATOR, "Ability to see 'ulx asay'", "Other" ) end -- Give operators access to see asays echoes by default
function ulx.asay( calling_ply, message )
local format
local me = "/me "
if message:sub( 1, me:len() ) == me then
format = "(ADMINS) *** #P " .. message:sub( me:len() + 1 )
else
if calling_ply:IsAdmin() then
format = "#P to admins: " .. message
else
format = "(ADMINS) #P: " .. message
end
end
local players = player.GetAll()
for i=#players, 1, -1 do
local v = players[ i ]
if not ULib.ucl.query( v, seeasayAccess ) and v ~= calling_ply then -- Calling player always gets to see the echo
table.remove( players, i )
end
end
ulx.fancyLog( players, format, calling_ply )
end
local asay = ulx.command( CATEGORY_NAME, "ulx asay", ulx.asay, "@", true, true )
asay:addParam{ type=ULib.cmds.StringArg, hint="message", ULib.cmds.takeRestOfLine }
asay:defaultAccess( ULib.ACCESS_ALL )
asay:help( "Send a message to currently connected admins." )
--- End code ---
Navigation
[0] Message Index
[*] Previous page
Go to full version