- Timestamp:
- Dec 12, 2015, 4:08:53 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/AllocsCommands/Commands/TeleportPlayer.cs
r250 r253 16 16 " 3. teleportplayer <inc x> <inc y> <inc z>\n" + 17 17 "1. Teleports the player given by his SteamID, player name or entity id (as given by e.g. \"lpi\")\n" + 18 " to the specified location \n" +18 " to the specified location. Use y = -1 to spawn on ground.\n" + 19 19 "2. As 1, but destination given by another player which has to be online\n" + 20 20 "3. Teleport the local player to the position calculated by his current position and the given offsets"; … … 33 33 ClientInfo ci1 = null; 34 34 EntityPlayer ep1 = null; 35 UnityEngine.Vector3 destPos; 35 36 36 37 if (_params.Count == 2 || _params.Count == 4) { … … 56 57 } 57 58 58 ep1.position.x = x;59 ep1.position.y = y;60 ep1.position.z = z;59 destPos.x = x; 60 destPos.y = y; 61 destPos.z = z; 61 62 } else if (_params.Count == 2) { 62 63 ClientInfo ci2 = ConsoleHelper.ParseParamIdOrName (_params [1]); … … 67 68 EntityPlayer ep2 = GameManager.Instance.World.Players.dict [ci2.entityId]; 68 69 69 ep1.position= ep2.GetPosition ();70 ep1.position.y += 1;71 ep1.position.z += 1;70 destPos = ep2.GetPosition (); 71 destPos.y += 1; 72 destPos.z += 1; 72 73 } 73 74 } else if (_params.Count == 3) { 74 75 if (_senderInfo.RemoteClientInfo == null) { 75 SdtdConsole.Instance.Output ("This command can only be executed on the in-game console.");76 SdtdConsole.Instance.Output ("This command can only be executed in variant 3 on the in-game console."); 76 77 return; 77 78 } … … 93 94 } 94 95 95 ep1.position.x = ep1.position.x + x;96 ep1.position.y = ep1.position.y + y;97 ep1.position.z = ep1.position.z + z;96 destPos.x = ep1.position.x + x; 97 destPos.y = ep1.position.y + y; 98 destPos.z = ep1.position.z + z; 98 99 } 99 100 100 NetPackage EntityTeleport pkg = new NetPackageEntityTeleport (ep1);101 NetPackageTeleportPlayer pkg = new NetPackageTeleportPlayer (destPos); 101 102 102 103 ci1.SendPackage (pkg);
Note:
See TracChangeset
for help on using the changeset viewer.