Hey all,
I'm currently coding a JS plugin and I've managed to get the following to print out a message in chat:
I'm curious if this message can only be seen by the "Initiator" or if it's a broadcast to the whole chat. Unfortunately I don't have anyone online right now to tell meCode:OnEntityDeath: function(entity, info){ info.Initiator.sendConsoleCommand("chat.add", "", "Hello World!"); }
Thanks in advance <3
Solved Does chat.add broadcast?
Discussion in 'Rust Development' started by Scriptzyy, Oct 21, 2016.
-
Wulf Community Admin
I'd suggest using Oxide's broadcast functions. The chat.add command will only add the chat to the target's client chat. The chat.say command would send it to the server for all to see, but as I mentioned you could use the wrappers Oxide provides too.
-
-
Wulf Community Admin
-
-
Wulf Community Admin
Code:var BarrelPoints = { Title: "BarrelPoints", Author: "Scriptzyy", Version: V(0, 1, 0), Description: "Gives players RewardPoints for destroying barrels.", HasConfig: true, LoadDefaultConfig: function(){ this.Config.options = { pointsPerBarrel: "5" } }, OnEntityDeath: function(entity, info){ if(entity.ShortPrefabName.Contains == "loot-barrel" || entity.ShortPrefabName == "oil_barrel" || entity.ShortPrefabName == "oil-barrel"){ info.Initiator.SendMessage("<color=#a6d8b0>You have gained +" + this.Config.options.pointsPerBarrel + " RP!</color>"); info.Initiator.SendConsoleCommand("sr add " + info.Initiator.displayName + " " + this.Config.options.pointsPerBarrel); } } }
-