NyxGrimlock

Untitled

Oct 28th, 2015
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.08 KB | None | 0 0
  1.  
  2. using System;
  3. using System.Collections.Generic;
  4.  
  5. using CodeHatch.Build;
  6. using CodeHatch.Engine.Networking;
  7. using CodeHatch.Networking.Events.Players;
  8.  
  9. namespace Oxide.Plugins
  10. {
  11.     [Info("Private Chat", "ZakMc", "1.0.0")]
  12.     public class Whisper : ReignOfKingsPlugin
  13.     {
  14.  
  15.         void Loaded()
  16.         {
  17.             cmd.AddChatCommand("whisper", this, "WhisperTo");
  18.         }
  19.  
  20.         void WhisperTo(Player player, string cmd, string[] args)
  21.         {
  22.             if( args.Length < 2 )
  23.             {
  24.                 PrintToChat(player, "Usage: /whisper username message");
  25.                
  26.                 return ;
  27.             }
  28.            
  29.             Player WhisperToPlayer = Server.GetPlayerByName( args[0] );
  30.            
  31.             if( WhisperToPlayer == null )
  32.             {
  33.                 PrintToChat(player, "Player not found");
  34.                
  35.                 return ;
  36.             }
  37.            
  38.             var whisperMessage = "";
  39.             foreach (var message in args)
  40.             {
  41.                 if( message == args[0] )
  42.                 {
  43.                     continue;
  44.                 }
  45.                 whisperMessage += " " + message;
  46.             }
  47.            
  48.             PrintToChat(WhisperToPlayer, "[22AA79]" + player.DisplayName + " : " + whisperMessage);
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment