1. I do have a question... when using "tostring( item.UserID )" in the print statement it returns a ulong in the output...
    [Oxide] Rejecting client (7.6561197977418e+016 in banlist)

    I spent a little time trying to see if I could get the actual ID (76561197977418126) using math.floor function but I could never
    get it to print correctly. It always displayed as a ulong. Any ideas on how to correct that?

    Thanks
     
  2. ZOR

    ZOR

    Code:
    string.format("%17.0f",item.UserID )
     
  3. Thanks ZOR... worked great!
     
  4. Hi everyone

    i'm trying to convert ulong to string but i'm having NO luck :(

    Code:
    local GetUsers, SetUsers = typesystem.GetField( Rust.PasswordLockableObject, "_validUsers", bf.private_instance )
    --local PasswordLockableObject = cs.gettype( "PasswordLockableObject, Assembly-CSharp")
    --local HasAccess = util.GetStaticMethod( Rust.PasswordLockableObject, "HasAccess", bf.public_static, { System.UInt64 } )
    function PLUGIN:CanOpenDoor( netuser, door )
        local deployable = door:GetComponent( "DeployableObject" )
        if (not deployable) then
            return
        end
        if(self.AdminLive[netuser]) then
            local lockable = door:GetComponent( "PasswordLockableObject" )
            local hashset = GetUsers(lockable)
            local it = hashset:GetEnumerator()
            while (it:MoveNext()) do
                print(cs.readulongfieldasstring( it.Current, it.Current ))
            end
        end
    end
    
    i tried to use tostring(it.Current) but it shows the ulong in 1.553654353E17 or whatever format
    and using: cs.readulongfieldasstring , well i'm not really getting a field so ...

    anybody got an idea?
     
  5. Have u tried it.Current:ToString() ?
    or u could try just getting the value out of the ulong - > m_value;
    or u could make and array out of it and have cs.convertandsetonarray handle it.
    or just check access with the HasAccess method on the PasswordLockableObject.
     
  6. it.Current:ToString() i tried ^^ doesnt work
    or u could try just getting the value out of the ulong - > m_value ??? how i don't really get it!
    cs.convertandsetonarray => i'll defenitly try it!!!! ty for the tip!
    or just check access with the HasAccess method on the PasswordLockableObject => tried ... failed, because i can only get from online players with rust.GetLongUserID,
    i want to make a plugin so we can see who have access to a door.
     
  7. Trust me u can use HasAccess to check access of online players only though, you even have all the code to do it in your r-bans plugin because I gave it to you before in an example!
     
  8. Î know how to do it for online players, but not offline players :([DOUBLEPOST=1409579120,1409536557][/DOUBLEPOST]ok tried but fail again:

    Code:
                local steamid = rust.CommunityIDToSteamID( tonumber(userid) )
                local steamid64 = tostring(self:ToSteamID64(steamid))
                print(steamid64)
                local idArr = util.ArrayFromTable( System.Object, { steamid64 }, 1 )
                cs.convertandsetonarray( idArr, 0, steamid64, System.UInt64._type )
                print(tostring(idArr[0]))
                print(type(idArr[0]))
    
    [Oxide] 76561197977714627
    [Oxide] 7.6561197977715e+016
    [Oxide] number
    it shows me this, :(
     
  9. Wulf

    Wulf Community Admin

    Did you ever figure out an elegant way of handling this? Running into this issue with Rust Experimental as well. The below options work, but they round up which we wouldn't want.
    Code:
    string.format("%.0f", userid)
    Code:
    string.format("%17.0f", userid)
     
  10. What are you trying to do? I remember having this problem aswell in legacy once when i wanted to get the steamid64 out of a userid by adding this mysterious number to it.
     
  11. Wulf

    Wulf Community Admin

    I'm trying to make the SteamID usable. Right now "connection.userid" from Rust returns 7.6561197960635e+016 as my SteamID, instead of 76561197960634567 which is what it should look like.
     
  12. rust.UserIDFromConnection and rust.UserIDFromPlayer have been added to Oxide 2, should be able to use those as a work-around for now. They return the user ID as a string.