Coinage

Face Stuff

May 16th, 2015
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.86 KB | None | 0 0
  1. // public static ints required
  2. // I'm coding in an console application in C#
  3.  
  4. public static int[] faceid = new int[100];   // 100 is enough since there can't be more than 100 users at a time.
  5.  
  6. // In case "add"
  7. case "add":
  8. int s = m.GetInt(0);
  9. faceid[s] = m.GetInt(2);  // this is the index number for retrieving the smiley id of the user.
  10. break;
  11.  
  12. // In case "face"
  13. case "face":
  14. int fid = m.GetInt(0);
  15. int f = m.GetInt(1);
  16. faceid[fid] = f;  // This is for the users that change their face id.
  17. break;
  18.  
  19. // In case "m"
  20. case "m":
  21. int p = m.GetInt(0);
  22. int X = Convert.ToInt32(Convert.ToDouble(m[1]) / 16);
  23. int Y = Convert.ToInt32(Convert.ToDouble(m[2]) / 16);
  24. int hor = m.GetInt(7);  // Checks if user pressed left/right
  25. int ver = m.GetInt(8);  // Checks if user pressed up/down
  26. bool jump = m.GetBoolean(10); // Checks if user pressed spacebar
  27. if (hor == 1)  // If user pressed right
  28.                     {
  29.                         if (faceid[p] == 39)  // Checks if user is using ghost smiley
  30.                         {
  31.                             if (blocks[0, X + 1, Y] != 0)       // This is my block array, using my world deserializer
  32.                             {                                   // Checks if the block next to player is an actual block
  33.                            
  34.                                 teleport(users[p], X + 3, Y + 1);   // If so, teleports the user
  35.                             }
  36.                         }
  37.                     }
  38.                     else if (hor == -1)    // Same thing here, except for left
  39.                     {
  40.                         if (faceid[p] == 39)
  41.                         {
  42.                             if (blocks[0, X - 1, Y] != 0)
  43.                             {
  44.                                 teleport(users[p], X - 1, Y + 1);
  45.                             }
  46.                         }
  47.                     }
Advertisement
Add Comment
Please, Sign In to add comment