So far Mr. President made this:
------------------------------ Asay ------------------------------
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 )
print(calling_ply)
local players = player.GetAll()
if calling_ply then
for i=#players, 1, -1 do
local v = players[ i ]
if ULib.ucl.query( v, seeasayAccess ) and v ~= calling_ply then
if ULib.ucl.query( calling_ply, seeasayAccess ) then
ULib.tsayColor(v, 1, Color(65,105,225), "::Admin:: ", team.GetColor(calling_ply:Team()), calling_ply:Nick(), Color(112,138,144), ": ", message ) ----------- This is line 30
else
ULib.tsayColor(v, 1, Color(0,0,0), "::User:: ", team.GetColor(calling_ply:Team()), calling_ply:Nick(), Color(119,136,153), ": ", message )
end
end
if v == calling_ply then
ULib.tsayColor(v, 1, Color(49,79,79), "::To Admins:: ", team.GetColor(calling_ply:Team()), calling_ply:Nick(), Color(112,138,144), ": ", message )
end
end
local logFile = ulx.convar( "logFile", "1", "Log to file (Can still echo if off). This is a global setting, nothing will be logged to file with this off.", ULib.ACCESS_SUPERADMIN )
if logFile:GetBool() then
ulx.logString( calling_ply:Nick() .. " to admins: " .. message, true )
end
else
for i=#players, 1, -1 do
local v = players[ i ]
ULib.tsayColor(v, 1, Color(80,80,80), "::Console to admins:: ", Color(112,138,144), ": ", message )
end
local logFile = ulx.convar( "logFile", "1", "Log to file (Can still echo if off). This is a global setting, nothing will be logged to file with this off.", ULib.ACCESS_SUPERADMIN )
if logFile:GetBool() then
ulx.logString( "Console to admins: " .. message, true )
end
end
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." )
And this is the error I am getting:
[NULL Entity]
L 10/08/2013 - 14:16:38: Lua Error:
[ERROR] addons/ulx/lua/ulx/modules/sh/chat.lua:30: attempt to call method 'Team' (a nil value)
1. call - addons/ulx/lua/ulx/modules/sh/chat.lua:30
2. __fn - addons/ulib/lua/ulib/shared/commands.lua:943
3. unknown - addons/ulib/lua/ulib/shared/commands.lua:1296
4. unknown - lua/includes/modules/concommand.lua:69