Jump to content

Keylock issue still happens if owner is dead and offline

Fixed 1.1.6 1.1.7

SiCkNeSs

Posted

https://codefling.com/files/support/17505-keylock-issue-sometimes-if-owner-logs-outcrashes/

This issue still happens, and can be replicated the same way:
Player 1 builds base with keylocks
Player 1 dies
Player 1 logs out while dead

Player 2 cannot access the keylocks


the issue seems to arise from the following:
 

private bool CheckPlayerHasShareLocksWithClanTeamEnabled(ulong steamID)
{
    if (!steamID.IsSteamId()) return false;
    var player = BasePlayer.FindAwakeOrSleeping(steamID.ToString());
    if (player == null || player.IsNpc) return false;
    return GetAutoLockPlayerSettingsData(player).ShareLocksWithClanTeamEnabled;
}

as when the player is dead and offline, they are not in the FindAwakeOrSleeping list

I have changed it to check iplayer list, which includes offline/dead players, and then if that is not null, convert it to a usable baseplayer to pass through to get the player settings.

dont know if this is the way you want to go about it, but was letting you know that the issue does not persist with this fix

private bool CheckPlayerHasShareLocksWithClanTeamEnabled(ulong steamID)
{
    if (!steamID.IsSteamId()) return false;
    var player = covalence.Players.FindPlayer(steamID.ToString());
    if (player == null) return false;

    var basePlayer = player.Object as BasePlayer;
    if (basePlayer.IsNpc) return false;

    return GetAutoLockPlayerSettingsData(basePlayer).ShareLocksWithClanTeamEnabled;
}

 

  • Like 1
Scalbox

Posted

3 hours ago, SiCkNeSs said:

https://codefling.com/files/support/17505-keylock-issue-sometimes-if-owner-logs-outcrashes/

This issue still happens, and can be replicated the same way:
Player 1 builds base with keylocks
Player 1 dies
Player 1 logs out while dead

Player 2 cannot access the keylocks


the issue seems to arise from the following:
 

private bool CheckPlayerHasShareLocksWithClanTeamEnabled(ulong steamID)
{
    if (!steamID.IsSteamId()) return false;
    var player = BasePlayer.FindAwakeOrSleeping(steamID.ToString());
    if (player == null || player.IsNpc) return false;
    return GetAutoLockPlayerSettingsData(player).ShareLocksWithClanTeamEnabled;
}

as when the player is dead and offline, they are not in the FindAwakeOrSleeping list

I have changed it to check iplayer list, which includes offline/dead players, and then if that is not null, convert it to a usable baseplayer to pass through to get the player settings.

dont know if this is the way you want to go about it, but was letting you know that the issue does not persist with this fix

private bool CheckPlayerHasShareLocksWithClanTeamEnabled(ulong steamID)
{
    if (!steamID.IsSteamId()) return false;
    var player = covalence.Players.FindPlayer(steamID.ToString());
    if (player == null) return false;

    var basePlayer = player.Object as BasePlayer;
    if (basePlayer.IsNpc) return false;

    return GetAutoLockPlayerSettingsData(basePlayer).ShareLocksWithClanTeamEnabled;
}

 

Hi, I'll make some changes to the plugin to fix the problem

Scalbox

Posted

1 hour ago, Scalbox said:

Hi, I'll make some changes to the plugin to fix the problem

I did a test and it doesn't work, if the player is offline, this code

player.Object as BasePlayer;


returns the same null.
In fact for these cases I use ServerUser

Scalbox

Posted

Changed Status from Pending to Fixed

Changed Fixed In to 1.1.7

1.6m

Downloads

Total number of downloads.

7.7k

Customers

Total customers served.

115.4k

Files Sold

Total number of files sold.

2.3m

Payments Processed

Total payments processed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.