Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // public static ints required
- // I'm coding in an console application in C#
- public static int[] faceid = new int[100]; // 100 is enough since there can't be more than 100 users at a time.
- // In case "add"
- case "add":
- int s = m.GetInt(0);
- faceid[s] = m.GetInt(2); // this is the index number for retrieving the smiley id of the user.
- break;
- // In case "face"
- case "face":
- int fid = m.GetInt(0);
- int f = m.GetInt(1);
- faceid[fid] = f; // This is for the users that change their face id.
- break;
- // In case "m"
- case "m":
- int p = m.GetInt(0);
- int X = Convert.ToInt32(Convert.ToDouble(m[1]) / 16);
- int Y = Convert.ToInt32(Convert.ToDouble(m[2]) / 16);
- int hor = m.GetInt(7); // Checks if user pressed left/right
- int ver = m.GetInt(8); // Checks if user pressed up/down
- bool jump = m.GetBoolean(10); // Checks if user pressed spacebar
- if (hor == 1) // If user pressed right
- {
- if (faceid[p] == 39) // Checks if user is using ghost smiley
- {
- if (blocks[0, X + 1, Y] != 0) // This is my block array, using my world deserializer
- { // Checks if the block next to player is an actual block
- teleport(users[p], X + 3, Y + 1); // If so, teleports the user
- }
- }
- }
- else if (hor == -1) // Same thing here, except for left
- {
- if (faceid[p] == 39)
- {
- if (blocks[0, X - 1, Y] != 0)
- {
- teleport(users[p], X - 1, Y + 1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment