Created
January 6, 2014 03:54
-
-
Save MrBluePotato/8277970 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void CheckIdles(object sender, fCraft.Events.PlayerMovingEventArgs e) | |
{ | |
if (e.Player.IdleTime.ToSeconds() % 5 == 0 && e.Player.IdleTime.ToSeconds() == 5 && !e.Player.isSolidBlock) | |
{ | |
//Temp debug message | |
Server.Message("{0} is idle!", e.Player.ClassyName); | |
e.Player.Info.IsHidden = true; | |
e.Player.isSolidBlock = true; | |
//Gets the coords of the player | |
short x = (short)(e.Player.Position.X / 32 * 32 + 16); | |
short y = (short)(e.Player.Position.Y / 32 * 32 + 16); | |
short z = (short)(e.Player.Position.Z / 32 * 32); | |
Vector3I Pos = new Vector3I(e.Player.Position.X / 32, e.Player.Position.Y / 32, (e.Player.Position.Z - 32) / 32); | |
//Converts player's model block into Block.*blockname* | |
Block playerBlock = Map.GetBlockByName(e.Player.Model); | |
//Places the block at the players current location | |
BlockUpdate blockUpdate = new BlockUpdate(null, Pos, playerBlock); | |
e.Player.World.Map.QueueUpdate(blockUpdate); | |
e.Player.WorldMap.SetBlock(Pos, playerBlock); | |
e.Player.Message("&cYou are now a solid block. Don't move!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment