Skip to content

Commit

Permalink
Fix Steam ID Format
Browse files Browse the repository at this point in the history
- Accounts for change in player's display name to grab SteamID64
  • Loading branch information
data-bomb committed Sep 5, 2024
1 parent c1fe88c commit 2ca73a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Si_AdminMod/HostActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class HostAction
{
public static bool AddAdmin(Player player, String powerText, byte level)
{
long playerSteamId = long.Parse(player.ToString().Split('_')[1]);
long playerSteamId = (long)player.PlayerID.SteamID.m_SteamID;

if (SiAdminMod.AdminList == null)
{
Expand Down
12 changes: 6 additions & 6 deletions Si_AdminMod/PlayerExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class PlayerAdmin : Player
{
public static bool CanAdminExecute(Player callerPlayer, Power power, Player? targetPlayer = null)
{
long playerSteamId = long.Parse(callerPlayer.ToString().Split('_')[1]);
long playerSteamId = (long)callerPlayer.PlayerID.SteamID.m_SteamID;
Admin? callerMatch = AdminMethods.FindAdminFromSteamId(playerSteamId);
Power callerPowers = Power.None;
if (callerMatch != null)
Expand Down Expand Up @@ -64,15 +64,15 @@ public static bool CanAdminExecute(Player callerPlayer, Power power, Player? tar

public static bool CanAdminTarget(Player callerPlayer, Player targetPlayer)
{
long callerSteamId = long.Parse(callerPlayer.ToString().Split('_')[1]);
long callerSteamId = (long)callerPlayer.PlayerID.SteamID.m_SteamID;
Admin? callerMatch = AdminMethods.FindAdminFromSteamId(callerSteamId);
byte callerLevel = 0;
if (callerMatch != null)
{
callerLevel = callerMatch.Level;
}

long targetSteamId = long.Parse(targetPlayer.ToString().Split('_')[1]);
long targetSteamId = (long)targetPlayer.PlayerID.SteamID.m_SteamID;
Admin? targetMatch = AdminMethods.FindAdminFromSteamId(targetSteamId);
byte targetLevel = 0;
if (targetMatch != null)
Expand All @@ -90,7 +90,7 @@ public static bool CanAdminTarget(Player callerPlayer, Player targetPlayer)

public static Power GetAdminPowers(Player callerPlayer)
{
long callerSteamId = long.Parse(callerPlayer.ToString().Split('_')[1]);
long callerSteamId = (long)callerPlayer.PlayerID.SteamID.m_SteamID;
Admin? match = AdminMethods.FindAdminFromSteamId(callerSteamId);
if (match != null)
{
Expand All @@ -102,7 +102,7 @@ public static Power GetAdminPowers(Player callerPlayer)

public static byte GetAdminLevel(Player callerPlayer)
{
long callerSteamId = long.Parse(callerPlayer.ToString().Split('_')[1]);
long callerSteamId = (long)callerPlayer.PlayerID.SteamID.m_SteamID;
Admin? match = AdminMethods.FindAdminFromSteamId(callerSteamId);
if (match != null)
{
Expand All @@ -114,7 +114,7 @@ public static byte GetAdminLevel(Player callerPlayer)

public static bool IsAdmin(Player callerPlayer)
{
long callerSteamId = long.Parse(callerPlayer.ToString().Split('_')[1]);
long callerSteamId = (long)callerPlayer.PlayerID.SteamID.m_SteamID;
Admin? match = AdminMethods.FindAdminFromSteamId(callerSteamId);
if (match != null)
{
Expand Down

0 comments on commit 2ca73a8

Please sign in to comment.