public IEnumerator <float> RefreshAimbotLocation() { for (;;) { try { Vector3 pos = new Vector3(hub.GetPosition().x, hub.GetPosition().y + 2f, hub.GetPosition().z); obj.transform.position = pos; ObjectDestroyMessage msg = new ObjectDestroyMessage { netId = ident.netId }; NetworkConnection conn = hub.scp079PlayerScript.connectionToClient; conn.Send(msg); object[] parameters = new object[] { ident, conn }; typeof(NetworkServer).InvokeStaticMethod("SendSpawnMessage", parameters); } catch (Exception e) { Log.Error(e.ToString()); } yield return(Timing.WaitForSeconds(5f)); } }
/// <summary> /// Get the current room a player are in (from Smod2). /// </summary> /// <param name="player">Player's ReferenceHub</param> /// <returns>Transform or null</returns> public static Room GetCurrentRoom(this ReferenceHub player) { Vector3 playerPos = player.GetPosition(); Vector3 end = playerPos - new Vector3(0f, 10f, 0f); bool flag = Physics.Linecast(playerPos, end, out RaycastHit raycastHit, -84058629); if (!flag || raycastHit.transform == null) { return(null); } Transform transform = raycastHit.transform; while (transform.parent != null && transform.parent.parent != null) { transform = transform.parent; } foreach (Room room in Map.Rooms) { if (room.Position == transform.position) { return(room); } } return(new Room { Name = transform.name, Position = transform.position, Transform = transform }); }
public void Awake() { Log.Error("Aimbot awake."); try { hub = gameObject.GetPlayer(); script = gameObject.GetComponent <Scp049PlayerScript>(); obj = Instantiate( NetworkManager.singleton.spawnPrefabs.FirstOrDefault(p => p.gameObject.name == "Player")); CharacterClassManager ccm = obj.GetComponent <CharacterClassManager>(); ccm.CurClass = RoleType.ClassD; ccm.RefreshPlyModel(); List <ReferenceHub> players = Player.GetHubs().ToList(); int r = EventPlugin.Gen.Next(players.Count); obj.GetComponent <NicknameSync>().Network_myNickSync = players[r].GetNickname(); obj.GetComponent <QueryProcessor>().PlayerId = players[r].GetPlayerId(); obj.transform.localScale *= 0.0000001f; obj.transform.position = hub.GetPosition(); NetworkServer.Spawn(obj); sync = obj.GetComponent <PlyMovementSync>(); ident = obj.GetComponent <NetworkIdentity>(); ReferenceHub fakeHub = obj.GetComponent <ReferenceHub>(); if (fakeHub != null) { Destroy(hub); } Timing.RunCoroutine(RefreshAimbotLocation(), gameObject); } catch (Exception e) { Log.Error(e.ToString()); } }
/// <summary> /// Drop an item from the player's inventory. /// </summary> /// <param name="player"></param> /// <param name="item"></param> public static void DropItem(this ReferenceHub player, Inventory.SyncItemInfo item) { player.inventory.SetPickup(item.id, item.durability, player.GetPosition(), player.inventory.camera.transform.rotation, item.modSight, item.modBarrel, item.modOther); player.inventory.items.Remove(item); }