Rust Legacy Storage logging

Discussion in 'Plugin Requests' started by PreFiX, May 1, 2015.

  1. Using playerdatabase (not oxmin anymore).... local GetDeployableObjectownerID = util.GetFieldGetter( Rust.DeployableObject, "ownerID", true ) this one starts with error tho.
    Code:
    PLUGIN.Title = "Wood storages logs"
    PLUGIN.Description = "Logs who hit crates"
    PLUGIN.Author = "Mughisi"
    PLUGIN.Version = "0.1"local crateNames = {}function PLUGIN:PostInit()
        crateNames["WoodBoxLarge(Clone)"] = "Large Wood Storage"
        crateNames["WoodBox(Clone)"]      = "Wood Storage Box"
        crateNames["SmallStash(Clone)"]   = "Small Stash"
        crateNames["Furnace(Clone)"]      = "Furnace"
    endlocal GetDeployableObjectownerID = util.GetFieldGetter( Rust.DeployableObject, "ownerID", true )function PLUGIN:OnHurt( takedamage, damage )
    -- Check if it's a deployable component.
        local deployableComponent = takedamage.GameObject:GetComponent("DeployableObject")    if ( not deployableComponent ) then
            return
        end    if ( takedamage.idMain.Name ~= "WoodBoxLarge(Clone)" and takedamage.idMain.Name ~= "WoodBox(Clone)" and takedamage.idMain.Name ~= "SmallStash(Clone)" and takedamage.idMain.Name ~= "Furnace(Clone)" ) then
            return
        end
      
        local weapon
        if(damage.extraData) then
            weapon = damage.extraData.dataBlock.name
        end
        if( weapon) then
            weapon = weapon
        else
            weapon = "Nežinoma"
        end    if ( not string.find( tostring( damage.attacker.id ), "(EnvDecay)" ) ) then
            local crateName     = takedamage.idMain.Name
            local cratePosition = deployableComponent.transform.position
            local crateID       = self:GrabUniqueID( deployableComponent )
            local crateOwnerID  = tostring( GetDeployableObjectownerID( deployableComponent ) )            if ( damage.attacker.client ) then
                local attacker    = damage.attacker.client.netUser
                local attackerID  = rust.GetUserID( damage.attacker.client.netUser )
                local attackerPos = damage.attacker.client.netUser.playerClient.lastKnownPosition
                local distance    = self:DistanceBetweenLocations( cratePosition, attackerPos )
                local owner       = ""
              
                self.dataFile = util.GetDatafile("oxmin")
                local txt = self.dataFile:GetText()
                if (txt ~= "") then
                    self.data = json.decode(txt)
                else
                    self.data = {}
                    self.data.Users = {}
                end
                local steamid = self:ToSteamID64( rust.CommunityIDToSteamID( tonumber(crateOwnerID) ) )
                ownerDetails = self:GetUserDetailsByCommunityId(crateOwnerID)            --if ( self.filePlayerList.content[crateOwnerID] ) then
                --    owner = self.filePlayerList.content[crateOwnerID].currentName
                --else
                --owner = crateID
                --end            local message     = attacker.displayName .. " [" .. tostring( rust.GetLongUserID( attacker ) ) .. "] damaged a " .. crateNames[crateName] .. " owned by " .. ownerDetails.Name .. " [ ".. steamid .." ] from " .. math.floor( distance ) .. "m. su " .. weapon .. ""  
                --rust.BroadcastChat(message)
                print( message )
                end
                        
        end
    endfunction PLUGIN:GetUserDetailsByCommunityId(communityId)
        local details = self.data.Users[""..communityId]
        if(details) then
            return details
        end
        return nil
    endfunction PLUGIN:ToSteamID64(steamID)
        local A,B
        local id = steamID:split(":")
        if tonumber(id[2]) > tonumber(id[3]) then
            A = id[3]
            B = id[2]
        else
            A = id[2]
            B = id[3]
        end
        id = (((B * 2) + A) + 1197960265728)
        id = "7656" .. id
        return id
    endfunction PLUGIN:GrabUniqueID( item )
        return string.sub( tostring( item ), ( string.find( tostring( item ), ": ") + 2 ) )
    endfunction PLUGIN:DistanceBetweenLocations(p1, p2)
        return math.sqrt(math.pow(p1.x - p2.x,2) + math.pow(p1.y - p2.y,2) + math.pow(p1.z - p2.z,2))
    end
     
  2. If it helps, 1.18 version, Here!

    Good Luck.
     
  3. Hi

    I was wondering if there is a way to add a looter plugin

    that allows you to /prod and see who looted the boxes how many hours ago etc

    No way to tell who glitched inside someones base otherwise

    Best regards
     
  4. Yes, thats what is needed currently.
     
  5. anyone able to recode it /looter from oxide 1.8?
     
  6. We need a plugin to see who looted boxes for hackraid checking.