Not workingSolved

I'll take a second look

I am no expert on coding, but tryed to find the error, maybe it helps you. Read the commets after the printwarnings :

var buildingPrivilege = entity.GetBuildingPrivilege();
PrintWarning(buildingPrivilege +" - OnEntityDeath is running");  // returns the same if im auth on tc and if im NOT auth on tc.
if (buildingPrivilege == null || buildingPrivilege.authorizedPlayers.IsEmpty()) return;
PrintWarning(buildingPrivilege +" - OnEntityDeath is running");  // warning prints only if im auth on tc and something is destroyed.

var victims = new List<ulong>(buildingPrivilege.authorizedPlayers.Count);
foreach (PlayerNameID victim in buildingPrivilege.authorizedPlayers)
{
if (victim == null) continue;
if (config.usePermissions && !permission.UserHasPermission(victim.userid.ToString(), PERMISSION)) return;
if (victim.userid == info.InitiatorPlayer.userID) return;
if (disabled.Contains(victim.userid)) continue;
victims.Add(victim.userid);
}
PrintWarning(buildingPrivilege +" - OnEntityDeath is running");  // Does never print this warning

 



Merged post

well im stuck i cant get this foreach to run and i cant figure out why...

foreach (PlayerNameID victim in buildingPrivilege.authorizedPlayers){

I've been playing on a server for almost a year now that uses this plugin. It barely works half the time and the Owner of the server said that if its a multi TC base that is what breaks the plugin. I hope this helps because I hate doing electrical smart alarms.

flosstradamus

I've been playing on a server for almost a year now that uses this plugin. It barely works half the time and the Owner of the server said that if its a multi TC base that is what breaks the plugin. I hope this helps because I hate doing electrical smart alarms.

Most definitely! I'll probably get some time tomorrow. 

ya i figured out that this is the problem. It cant cycle auth players at TC

foreach (PlayerNameID victim in buildingPrivilege.authorizedPlayers)
{
if (victim == null) continue;
if (config.usePermissions && !permission.UserHasPermission(victim.userid.ToString(), PERMISSION)) return;
if (victim.userid == info.InitiatorPlayer.userID) return;
if (disabled.Contains(victim.userid)) continue;
victims.Add(victim.userid);
}

I'm assuming these servers used the permissions setting. Fixed a bug where victims could be skipped resulting in no message.

Thanks !