Help with On UserDisconnected & On UserConnectedNot An Issue

What's wrong with this bit ?

void OnUserConnected(Player player)
{
    if (permission.UserHasPermission(player.UserIDString, "notifier.bypass"))
        return;

    InitializePlayer(player);
}

void OnUserDisconnected(Player player)
{
    if (permission.UserHasPermission(player.UserIDString, "notifier.bypass"))
        return;

    string uid = player.UserIDString;
    if (PlayersData.ContainsKey(uid))
    {
        string LeaveMessage = GetMsg("Leave Notification");
        if (reason.StartsWith("Kicked: "))
            reason = "Kicked: " + reason.Replace(reason.Split()[0], "").Trim();
        if (EnableLeaveMessage && NotHide(player))
            Say(ReplaceNameFormats(LeaveMessage.Replace("{reason}", reason), player));
    }
}

What's the issue?

  1. You can can use player.HasPermission instead of permission.UserHasPermission when using IPlayer
  2. You do not need to store the player ID in a variable, and also IPlayer doesn't container "UserIDString", just use player.Id
  3. You do not have the string reason as an arg in OnUserDisconnected, so you can't just use it without adding that
  4. You need to pass the player's ID with any localization handling such as your GetMsg method in order for localization to actually work fully
  5. I have no idea what InitializePlayer, PlayersData, and other parts of your code look like that the above utilizes
  6. The compiler on the server and any IDE should be able to show you any errors

@wulf

I'm not in to coding or configuring. I'm simply just messing around - it's the old plugin called "Notifier" I'm trying to get fully working again, could I link the full cs file ?

 

I'm simply after it showing the player join & leave msg + welcome message 

 

I'd appriciate it if so

Yeah I've looked at both of them already, but they don't feature the things I'm after sadly :(

They have join/quit messages, the same as you were looking to do with Notifier. I'm not sure what else you're wanting.

Welcome message / whisper to the joined player + timed notifications, players online/joining etc. It's a good combined one - randomly stopped working with a few of the features sadly. I guess I'll try to find a coder to make it work again :) Thanks for you time though! Much appriciated :D

Pretty sure someone maintains it on another site already, but I wouldn't recommend AIO type plugins generally for this very reason. 

Locked automatically