Интеграция SLogs с SAM

Помогите переписать функцию логов с ULX под SAM админку)

SLogs:Hook( "ULibPostTranslatedCommand", function( ply, command, args )

	local target
	if istable( args[ 2 ] ) and IsValid( args[ 2 ][ 1 ] ) and args[ 2 ][ 1 ]:IsPlayer( ) then
		target = args[ 2 ][ 1 ]
	end

	local args_str = nil
	for k,v in next, args, target and 2 or 1 do
		if isbool( v ) then continue end
		args_str = (args_str or "") .. (args_str and ", " or "") .. tostring( v )
	end

	if target then
		return {
			T = ULXID,
			I = Either( args_str, 0, 2 ),
			E = {
				ply1 = SLogs:ValidCall( ply, "GetName" ) or "КОНСОЛЬ",
				ply2 = SLogs:ValidCall( target, "GetName" ),

				sid1 = SLogs:ValidCall( ply, "SteamID" ),
				sid2 = SLogs:ValidCall( target, "SteamID" ),

				str1 = command,
				str2 = args_str,
			}
		}
	else
		return {
			T = ULXID,
			I = Either( args_str, 1, 3 ),
			E = {
				ply1 = SLogs:ValidCall( ply, "GetName" ) or "КОНСОЛЬ",

				sid1 = SLogs:ValidCall( ply, "SteamID" ),

				str1 = command,
				str2 = args_str,
			}
		}
	end

end )

получилось? скинь если да)

SLogs:Hook("SAM.ParsedCommand", function(ply, cmd, args)
    local plyName = (IsValid(ply) and ply:IsPlayer()) and SLogs:ValidCall(ply, "GetName") or "КОНСОЛЬ"
    local plySID = (IsValid(ply) and ply:IsPlayer()) and SLogs:ValidCall(ply, "SteamID") or "N/A"

    local target

    if istable(args) and args[1] then
        local maybeTarget = args[1]
        if istable(maybeTarget) then
            if IsValid(maybeTarget[1]) and maybeTarget[1]:IsPlayer() then
                target = maybeTarget[1]
            end
        elseif IsValid(maybeTarget) and maybeTarget:IsPlayer() then
            target = maybeTarget
        end
    end

    local args_str
    local startIndex = target and 2 or 1

    for i = startIndex, #args do
        local v = args[i]
        if v ~= nil and not isbool(v) then
            args_str = (args_str and (args_str .. ", ") or "") .. tostring(v)
        end
    end

    if target then
        return {
            T = "SAMID",
            I = Either(args_str, 0, 2),
            E = {
                ply1 = plyName,
                ply2 = SLogs:ValidCall(target, "GetName") or "Unknown",

                sid1 = plySID,
                sid2 = SLogs:ValidCall(target, "SteamID") or "N/A",

                str1 = cmd,
                str2 = args_str or "",
            }
        }
    else
        return {
            T = "SAMID",
            I = Either(args_str, 1, 3),
            E = {
                ply1 = plyName,

                sid1 = plySID,

                str1 = cmd,
                str2 = args_str or "",
            }
        }
    end
end)

Нейронка в помощь.

1 лайк