Resource icon

Approved DeathMSG 1.3a

No permission to download
Code:
[10/4/2014 2:45:09 PM] [Debug] User Connected: [r1oT]MEEPMEEP (76561198146539077 | 96.247.64.167)
[10/4/2014 2:45:09 PM] [Console] [AC] Nick: [r1oT]MEEPMEEP. Banned chars in name.
[10/4/2014 2:45:09 PM] [Debug] User Disconnected: [r1oT]MEEPMEEP (76561198146539077)
[10/4/2014 2:45:09 PM] [Error] [Magma] Error invoking function On_PlayerConnected in DeathMSG plugin.
[10/4/2014 2:45:09 PM] [Exception] [ Plugin->Invoke | Plugin->OnPlayerConnected | Hooks->PlayerConnect | RustServerManagement->OnUserConnected | ConnectionAcceptor->uLink_OnPlayerConnected | GameObject->SendMessage | #=qSBVG6i3HoKQx$z3bwADYIgVX_kCktQP8JwBh1CI$O_8=->#=qnBC8vvHltGiAoAcoGPaaAA== | #=qSBVG6i3HoKQx$z3bwADYIgVX_kCktQP8JwBh1CI$O_8=->#=qopOwgPOjk_HOzOwWVDsWIQ== | #=qr9YotdsWVwSdbrj6D5OlmHWwwJVhBeBIJ5J461Az$DQ=->#=qM25p$Ei_tgo0VZPqr5NeJg== | #=qxj6gmeF_JmZ38rfyBJuqFoiB_sAo6WCf4j1AdQtxGgQ=->#=q2HqDTZFVDws8Yv2UHd8me8CJU2rmEhl0UENDzxjFAFA= | #=qxj6gmeF_JmZ38rfyBJuqFoiB_sAo6WCf4j1AdQtxGgQ=->#=qGm_HL$oYHQfIKbtxj_QFnQ== | NetworkPlayerApproval->Approve | <AuthorisationRoutine>c__Iterator31->MoveNext | ]
System.NullReferenceException: Object reference not set to an instance of an object
at Fougerite.Player.get_SteamID () <0x0002a>
at (wrapper dynamic-method) Jint.Marshal.ProxyHelper.dynamicPropertyGetter (Jint.Marshaller,Jint.Native.JsDictionaryObject) <0x00029>
at Jint.Native.NativeDescriptor.Get (Jint.Native.JsDictionaryObject) <0x0002a>
at Jint.Native.JsDictionaryObject.TryGetProperty (string,Jint.Native.JsInstance&) <0x00047>
at Jint.ExecutionVisitor.Visit (Jint.Expressions.PropertyExpression) <0x00085>
at Jint.Expressions.PropertyExpression.Accept (Jint.Expressions.IStatementVisitor) <0x0001e>
at Jint.ExecutionVisitor.Visit (Jint.Expressions.MemberExpression) <0x0003e>
at Jint.Expressions.MemberExpression.Accept (Jint.Expressions.IStatementVisitor) <0x0001e>
at Jint.ExecutionVisitor.Visit (Jint.Expressions.VariableDeclarationStatement) <0x0003c>
at Jint.Expressions.VariableDeclarationStatement.Accept (Jint.Expressions.IStatementVisitor) <0x0001e>
at Jint.ExecutionVisitor.Visit (Jint.Expressions.BlockStatement) <0x000b4>
at Jint.Expressions.BlockStatement.Accept (Jint.Expressions.IStatementVisitor) <0x0001e>
at Jint.ExecutionVisitor.Visit (Jint.Expressions.BlockStatement) <0x000b4>
at Jint.Expressions.BlockStatement.Accept (Jint.Expressions.IStatementVisitor) <0x0001e>
at Jint.Native.JsFunction.Execute (Jint.Expressions.IJintVisitor,Jint.Native.JsDictionaryObject,Jint.Native.JsInstance[]) <0x0008c>
at Jint.ExecutionVisitor.ExecuteFunction (Jint.Native.JsFunction,Jint.Native.JsDictionaryObject,Jint.Native.JsInstance[],System.Type[]) <0x0033c>
at Jint.ExecutionVisitor.ExecuteFunction (Jint.Native.JsFunction,Jint.Native.JsDictionaryObject,Jint.Native.JsInstance[]) <0x0001b>
at Jint.JintEngine.CallFunction (Jint.Native.JsFunction,object[]) <0x00066>
at Jint.JintEngine.CallFunction (string,object[]) <0x00094>
at MagmaPlugin.Plugin.Invoke (string,object[]) <0x00024>
Here is a temp fix until I update:

JavaScript:
function On_PlayerConnected(Player)
{
    var id;
    try {
        id = Player.SteamID;
    }
    catch(err) {
        Plugin.Log("DeathMSGErr", "Error caught at conn method. Player was null.");
        return;
    }
    var ini = DMB();
    var ip = Player.IP;
    var config = DeathMSGConfig();
    var deathmsgname = config.GetSetting("Settings", "deathmsgname");
    if (ini.GetSetting("Ips", ip) != null && ini.GetSetting("Ips", ip) == "1") {
        Player.MessageFrom(deathmsgname, "You are banned from this server");
        Player.Disconnect();
        return;
    }
    if (ini.GetSetting("Ids", id) != null && ini.GetSetting("Ids", id) == "1") {
        Player.MessageFrom(deathmsgname, "You are banned from this server");
        Player.Disconnect();
    }
}
 
Did you know a plugin can change the message that appears on the death screen?

Did you know that a plugin can pop up the death screen with a custom message on a player at any time, whether they have died or not? Good way to get the attention of a player who is misbehaving. ;)
 
Did you know a plugin can change the message that appears on the death screen?

Did you know that a plugin can pop up the death screen with a custom message on a player at any time, whether they have died or not? Good way to get the attention of a player who is misbehaving. ;)
How would one go about doing this?
 
Did you know a plugin can change the message that appears on the death screen?

Did you know that a plugin can pop up the death screen with a custom message on a player at any time, whether they have died or not? Good way to get the attention of a player who is misbehaving. ;)
Not good when I want to announce the message to the public. Maybe only to the two persons.

Sent from my Samsung Galaxy S4
 
How would one go about doing this?

JavaScript:
// in a method that was passed Fougerite.Player = Player
// this is for Magma, Jint is slightly different.  Python, FIIK.
var message = "This is the Death Screen Message";
var worker;
if(Util.TryFindType("ConsoleNetworker", worker)) {
  worker.SendClientCommand(Player.PlayerClient.netPlayer, "chat.add deathscreen.reason " + Facepunch.Utility.String.QuoteSafe(message));
  worker.SendClientCommand(Player.PlayerClient.netPlayer, "chat.add deathscreen.show");
}
// to Broadcast to all players:
// worker.Broadcast("chat.add deathscreen.reason " + Facepunch.Utility.String.QuoteSafe(message));
// worker.Broadcast("chat.add deathscreen.show");
// any client-side console command can be sent this way, except "chat.add suicide", for some reason... must be client-side only, somehow
 
  • Informative
Reactions: DreTaX
Oops. I forgot there is a SendCommand method on Fougerite.Player. So it's even easier:

JavaScript:
Player.SendCommand("chat.add deathscreen.reason "+ Facepunch.Utility.String.QuoteSafe("DIE SCUM!"));
Player.SendCommand("chat.add deathscreen.show");

You still need to TryFindType for the ConsoleNetworker class to do the Broadcast, though.

This is how the show grass and show dick plugins work.
 
JavaScript:
// in a method that was passed Fougerite.Player = Player
// this is for Magma, Jint is slightly different.  Python, FIIK.
var message = "This is the Death Screen Message";
var worker;
if(Util.TryFindType("ConsoleNetworker", worker)) {
  worker.SendClientCommand(Player.PlayerClient.netPlayer, "chat.add deathscreen.reason " + Facepunch.Utility.String.QuoteSafe(message));
  worker.SendClientCommand(Player.PlayerClient.netPlayer, "chat.add deathscreen.show");
}
// to Broadcast to all players:
// worker.Broadcast("chat.add deathscreen.reason " + Facepunch.Utility.String.QuoteSafe(message));
// worker.Broadcast("chat.add deathscreen.show");
// any client-side console command can be sent this way, except "chat.add suicide", for some reason... must be client-side only, somehow
Ugly javascript code

Sent from my Samsung Galaxy S4
 
good Morning
In this new update, does not show how many meters
the player was killed, only shows when suicide or die by an animal
 
good day
I noticed that when players come with the names of animals, he can shoot long distance without being caught by the system identified the death of an animal.
Exemplo: john entered the server name with the bear.
It if he kills someone the message is this: guy was killed by a bear.
We can Fix?
 
a serious problem here, if a player gets shot and then teleport to another place, shows that he died at a distance and as abusive head shot.

Also if you are very close to the player and give a shot in the head, shows you shot to abuse distance
 
a serious problem here, if a player gets shot and then teleport to another place, shows that he died at a distance and as abusive head shot.

Also if you are very close to the player and give a shot in the head, shows you shot to abuse distance
Currently I'm using DataStore to avoid this problem, but It seems I will need to add a 3 secs delay, and then remove It.