General > Developers Corner

Lua Error - log.lua

<< < (3/3)

Megiddo:
No... this error is coming from the code you modified, not any of the default ULX code.

sabo:
I just got this little sweetie here:


--- Code: ---[ERROR] addons/ulx/lua/ulx/modules/sh/chat.lua:25: attempt to call method 'Team' (a nil value)
1. call - addons/ulx/lua/ulx/modules/sh/chat.lua:25
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
--- End code ---


It is 100% the admin chat tho.

Megiddo:
Sabo, this is not coming from our chat.lua. Line 25 is [[format = "#P to admins: #s"]]. I suggest reverting back to default code.

MrPresident:
This is from the modified ulx.asay code I posted in another thread.

I never intended for the code to be run by console and since the isn't a player and has no team, it's throwing this error.

I'm working with him to fix it.

sabo:
So far Mr. President made this:


--- Code: ---    ------------------------------ 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." )

--- End code ---

And this is the error I am getting:


--- Code: ---[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

--- End code ---

Navigation

[0] Message Index

[*] Previous page

Go to full version