Error while compiling

Error while compiling NoDecay: Cannot convert type 'ulong' to 'ProtoBuf.PlayerNameID' | Line: 256, Pos: 13

I'm getting the same exact error. I don't know enough about coding to fix that line and my Google-Fu hasn't turned up an answer.

Hi everyone,

I don’t really know much about coding either, but I think I found a simple fix for the error
“Cannot convert type 'ulong' to 'ProtoBuf.PlayerNameID'”.

You can replace the code around line 249–270 with this:

private bool CheckAllToolCupboardPlayers(BuildingPrivlidge toolCupboard)
{
    if (toolCupboard == null || !toolCupboard.AnyAuthed())
    {
        return false;
    }

    foreach (ulong userId in toolCupboard.authorizedPlayers)  // ✅ CHANGED!
    {
        if (userId == 0UL)  // ✅ CHANGED!
        {
            continue;
        }
        
        if (permission.UserHasPermission(userId.ToString(), _config.General.permission))
        {
            return true;
        }
    }

    return false;
}

It seems like authorizedPlayers now stores ulong IDs instead of PlayerNameID objects after the latest Rust update,
so switching the loop to use ulong userId fixes the compile error.

Hope this helps someone! 🙂

SkunkDude

Hi everyone,

I don’t really know much about coding either, but I think I found a simple fix for the error
“Cannot convert type 'ulong' to 'ProtoBuf.PlayerNameID'”.

You can replace the code around line 249–270 with this:

private bool CheckAllToolCupboardPlayers(BuildingPrivlidge toolCupboard)
{
    if (toolCupboard == null || !toolCupboard.AnyAuthed())
    {
        return false;
    }

    foreach (ulong userId in toolCupboard.authorizedPlayers)  // ✅ CHANGED!
    {
        if (userId == 0UL)  // ✅ CHANGED!
        {
            continue;
        }
        
        if (permission.UserHasPermission(userId.ToString(), _config.General.permission))
        {
            return true;
        }
    }

    return false;
}

It seems like authorizedPlayers now stores ulong IDs instead of PlayerNameID objects after the latest Rust update,
so switching the loop to use ulong userId fixes the compile error.

Hope this helps someone! 🙂

Thanks