Advertisement
Guest User

stuff

a guest
Apr 26th, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using PlayerIOClient;
  4.  
  5.  
  6. namespace ExampleProgram
  7. {
  8. class Program
  9. {
  10. public static Connection conn;
  11. public static Client client;
  12. public static List<string> names = new List<string>();
  13. public static Random ran = new Random();
  14.  
  15. static void Main(string[] args)
  16. {
  17. client = PlayerIO.QuickConnect.SimpleConnect("everybody-edits-su9rn58o40itdbnw69plyw", "bill@bill.com", "bill", null);
  18. conn = client.Multiplayer.JoinRoom("PW5OjmRHR3bUI", null);
  19. conn.OnMessage += OnMessage;
  20.  
  21. conn.Send("init");
  22. Console.Read();
  23. }
  24.  
  25. static void OnMessage(object sender, Message m)
  26. {
  27. if (m.Type == "init") conn.Send("init2");
  28.  
  29. if (m.Type == "add")
  30. names.Add(m.GetString(1));
  31.  
  32. if (m.Type == "say")
  33. {
  34. if (m.GetString(1) == ".test")
  35. {
  36. conn.Send("say", "I love you, " + names[ran.Next(names.Count)]);
  37. }
  38. }
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement