using System; using System.Collections.Generic; using Oxide.Core; using UnityEngine; namespace Oxide.Plugins { [Info("AdminTP", "Xex", "1.1.1")] class AdminTP : RustPlugin { void Init() { permission.RegisterPermission("admintp.use", this); } [ChatCommand("tp")] private void ChatCommandTP(BasePlayer player, string command, string[] args) { if (!permission.UserHasPermission(player.UserIDString, "admintp.use")) { PrintMsgL(player, "Yetki Yok"); return; } if (args.Length < 1) { PrintMsgL(player, "SyntaxTP"); return; } string targetName = args[0]; BasePlayer targetPlayer = FindPlayerByName(targetName); if (targetPlayer == null) { PrintMsgL(player, "Kullanıcı bulunamadı."); return; } TeleportAdminToPlayer(player, targetPlayer); } [ChatCommand("tptomeall")] private void ChatCommandTPToMeAll(BasePlayer player, string command, string[] args) { if (!permission.UserHasPermission(player.UserIDString, "admintp.use")) { PrintMsgL(player, "Yetki Yok"); return; } foreach (BasePlayer targetPlayer in BasePlayer.activePlayerList) { if (targetPlayer != player) { TeleportPlayerToAdmin(player, targetPlayer); } } PrintMsgL(player, "Tüm oyuncular sana teleport edildi."); } private BasePlayer FindPlayerByName(string name) { foreach (BasePlayer player in BasePlayer.activePlayerList) { if (player.displayName.Contains(name, StringComparison.OrdinalIgnoreCase)) { return player; } } return null; } private void TeleportAdminToPlayer(BasePlayer admin, BasePlayer target) { Vector3 position = target.transform.position; admin.Teleport(position.x, position.y, position.z); PrintMsgL(admin, $"{target.displayName} oyuncusunun yanına teleport oldun."); } private void TeleportPlayerToAdmin(BasePlayer admin, BasePlayer target) { Vector3 position = admin.transform.position; target.Teleport(position.x, position.y, position.z); PrintMsgL(admin, $"{target.displayName} sana teleport edildi."); } private void PrintMsgL(BasePlayer player, string langKey, params object[] args) { string message = lang.GetMessage(langKey, this, player.UserIDString); if (string.IsNullOrEmpty(message)) { message = $"Hata: '{langKey}' dil anahtarı bulunamadı. Lütfen sunucu yöneticisi ile iletişime geçin."; } PrintToChat(player, string.Format(message, args)); } } }