Solved Send message to a player
Discussion in 'Rust Development' started by [Jedi Knight] StarD, Nov 18, 2016.
-
Wulf Community Admin
The way you are using PrintToChat with a player, it will only be sent to play player. If you use PrintToChat without a player, it will broadcast like you said. Check to make sure which method you are using.
-
Here`s part of code:
Code:[ChatCommand("rollbp")] void RollBp(BasePlayer player, string command, string[] args) { if(IsAllowed(player, "LegBPS.CanChangeBps")) { Item item = ItemManager.CreateByItemID(-1887162396, 1, 1); item.blueprintTarget = rndBp.GetRandomBp(); player.GiveItem(item); string msg = String.Format("Поздравляем! Вы выиграли чертёж {0}!", ItemManager.FindItemDefinition(item.blueprintTarget).shortname); PrintToChat(player, msg); //player.ChatMessage(String.Format("Поздравляем! Вы выиграли чертёж {0}!", ItemManager.FindItemDefinition(item.blueprintTarget).shortname)); //This works correctly } } -
Wulf Community Admin
player.ChatMessage("hello") would be the same as PrintToChat(player, "hello").
PrintToChat("hello") however would not be the same, that is a broadcast as there is no player given. -
Yes, I understand. But, as I said, when I`m using PrintToChat(player, msg) everyone recieves it. Mystery. Anyway, thanks for help!
-
Wulf Community Admin
![[Jedi Knight] StarD](/assets/styles/oxide/logo.og.png)