SmartlyDressedGames / Legally-Distinct-Missile

Fork of Rocket for Unturned maintained by the game developers.
MIT License
79 stars 29 forks source link

SteamGroupName() Issue #50

Closed sonnymack closed 2 years ago

sonnymack commented 2 years ago

When i use this code i get an error:

        if (player.SteamGroupName() == "DTG - Australian Police Department")
         {
             pd += 1;
             return;
         }
         if (player.SteamGroupName() == "DTG Unturned | Altis Paramedic Service")
         {
             ems += 1;
             return;
         }
         else civ += 1;
    }

    `Error in MulticastDelegate PlayerConnected: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Steamworks is not initialized.

at Steamworks.InteropHelp.TestIfAvailableClient () [0x0001d] in <9ec39cf9870242679bfb3f359d18d3c2>:0 at Steamworks.SteamFriends.GetFriendsGroupName (Steamworks.FriendsGroupID_t friendsGroupID) [0x00000] in <9ec39cf9870242679bfb3f359d18d3c2>:0 at Rocket.Unturned.Player.UnturnedPlayer.SteamGroupName () [0x00013] in <2bd16e190c814af1b48a905be636fbb4>:0 at DTGHud.DTGHUD.OnPlayerJoined (Rocket.Unturned.Player.UnturnedPlayer player) [0x00012] in <1f5c6b1f0a714993aff469fb63acd5b3>:0 at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in :0`

This is rocket throwing an exception right?

SDGNelson commented 2 years ago

It looks like Rocket throwing an exception, but it also looks like it probably never worked correctly if it is using the client interface. What I would recommend rather than comparing the name is comparing the group ID to the clan's steam ID this way it works even if the group is renamed.