private void Throwed(UseableThrowable useable, GameObject throwable) { UnturnedPlayer player = UnturnedPlayer.FromPlayer(useable.player); string message = Configuration.Instance.AnnouncMessage.Replace('{', '<').Replace('}', '>').Replace("%PLAYERNAME%", player.DisplayName); if (player.HasPermission(Configuration.Instance.SupplyPermission)) { foreach (var itemid in Configuration.Instance.SignalSmokes) { if (useable.equippedThrowableAsset.id == itemid) { GetAirdrop(throwable.transform.localPosition); if (Configuration.Instance.SupplyAnnounce == true) { ChatManager.serverSendMessage(message, Color.white, null, null, EChatMode.SAY, Configuration.Instance.AnnouncImgUrl, true); return; } else { return; } } } } else { UnturnedChat.Say(player, Translate("PermissionMessage"), Color.red); } }
private void Awake() { Instance = this; Provider.onServerDisconnected += (CSteamID r) => { if (r != CSteamID.Nil) { OnPlayerDisconnected.TryInvoke(UnturnedPlayer.FromCSteamID(r)); } }; Provider.onServerShutdown += () => { onShutdown.TryInvoke(); }; Provider.onServerConnected += (CSteamID r) => { if (r != CSteamID.Nil) { UnturnedPlayer p = (UnturnedPlayer)UnturnedPlayer.FromCSteamID(r); p.Player.gameObject.TryAddComponent <UnturnedPlayerFeatures>(); p.Player.gameObject.TryAddComponent <UnturnedPlayerMovement>(); p.Player.gameObject.TryAddComponent <UnturnedPlayerEvents>(); OnBeforePlayerConnected.TryInvoke(p); } }; DamageTool.playerDamaged += (SDG.Unturned.Player player, ref EDeathCause cause, ref ELimb limb, ref CSteamID killer, ref Vector3 direction, ref float damage, ref float times, ref bool canDamage) => { if (OnPlayerDamaged != null) { if (player != null && killer != CSteamID.Nil && killer != null) { UnturnedPlayer getterDamage = UnturnedPlayer.FromPlayer(player); UnturnedPlayer senderDamage = UnturnedPlayer.FromCSteamID(killer); OnPlayerDamaged.TryInvoke(getterDamage, cause, limb, senderDamage, direction, damage, times, canDamage); } } }; }
private void Awake() { Instance = this; Provider.onServerDisconnected += (CSteamID r) => { if (r != CSteamID.Nil) { OnPlayerDisconnected.TryInvoke(UnturnedPlayer.FromCSteamID(r)); } }; Provider.onServerShutdown += () => { onShutdown.TryInvoke(); }; Provider.onServerConnected += (CSteamID r) => { if (r != CSteamID.Nil) { UnturnedPlayer p = (UnturnedPlayer)UnturnedPlayer.FromCSteamID(r); p.Player.gameObject.TryAddComponent <UnturnedPlayerFeatures>(); p.Player.gameObject.TryAddComponent <UnturnedPlayerMovement>(); p.Player.gameObject.TryAddComponent <UnturnedPlayerEvents>(); OnBeforePlayerConnected.TryInvoke(p); } }; DamageTool.damagePlayerRequested += (ref DamagePlayerParameters parameters, ref bool shouldAllow) => { if (OnPlayerDamaged != null) { if (parameters.player != null && parameters.killer != CSteamID.Nil && parameters.killer != null) { UnturnedPlayer getterDamage = UnturnedPlayer.FromPlayer(parameters.player); UnturnedPlayer senderDamage = UnturnedPlayer.FromCSteamID(parameters.killer); OnPlayerDamaged.TryInvoke(getterDamage, parameters.cause, parameters.limb, senderDamage, parameters.direction, parameters.damage, parameters.times, shouldAllow); } } }; }
public bool CheckForFinish() { bool result = DateTime.UtcNow > FinishDate; if (result) { var winner = Auction.Bids.LastOrDefault(); if (winner == null) { Plugin.Say("AUCTION_FINISHED_NO_WINNER", Color.green); Auction.GivebackItems(); return(result); } for (int i = 1; i < Auction.Bids.Count; i++) { var bid = Auction.Bids.ElementAt(i); Plugin.Instance.AwardManager.RewardPlayer(bid.Player.Id, bid.Amount); if (!bid.Player.IsOnline) { continue; } UnturnedPlayer player = UnturnedPlayer.FromPlayer(bid.Player.Player); Plugin.Say(player, "LOST_AUCTION", Color.green, bid.Amount); } Plugin.Say("AUCTION_FINISHED", Color.green, winner.Player.CharacterName, winner.Amount); Auction.ResolveAuction(winner.Player.Id, winner.Amount); } return(result); }
internal static bool Prefix(UseableBarricade __instance, uint simulation, bool inputSteady) { UnturnedPlayer player = UnturnedPlayer.FromPlayer(__instance.player); if (player.HasPermission("realestate.bypass")) { return(true); } if (GetValue <bool>(__instance, "isUsing", BindingFlags.NonPublic | BindingFlags.Instance)) { if (GetValue <InteractableVehicle>(__instance, "parentVehicle", BindingFlags.NonPublic | BindingFlags.Instance) != null && RealEstate.instance.Configuration.Instance.enableBuildingOnVehicles) { return(true); } House house = RealEstate.manager.HouseFromPosition(GetValue <Vector3>(__instance, "point", BindingFlags.NonPublic | BindingFlags.Instance)); if (house == null && RealEstate.instance.Configuration.Instance.disableBuildingIfNotInHome) { __instance.player.equipment.dequip(); UnturnedChat.Say(player, RealEstate.instance.Translate("cant_build_outside"), Color.red); return(false); } if (!HouseManager.HouseCheck(house, player)) { __instance.player.equipment.dequip(); UnturnedChat.Say(player, RealEstate.instance.Translate("cant_place_barricades"), Color.red); return(false); } } return(true); }
private void onExitVechicleRequeseted(Player player, InteractableVehicle vehicle, ref bool shouldAllow, ref Vector3 pendingLocation, ref float pendingYaw) { if (vehicle.asset.id == Configuration.Instance.BusID) { RocketPermissionsGroup group = R.Permissions.GetGroup(AutoBusPlugin.pluginInstance.Configuration.Instance.BusGroupID); UnturnedPlayer uPlayer = UnturnedPlayer.FromPlayer(player); if (isInGroup(group, uPlayer) && (GetDriver(vehicle, uPlayer) == uPlayer)) { int asiento = vehicle.passengers.Length; while (asiento >= 0) { SteamPlayer steamPlayer = vehicle.passengers[asiento].player; if (steamPlayer != null) { UnturnedPlayer unturnedPlayer = UnturnedPlayer.FromPlayer(player); ChatManager.serverSendMessage(String.Format(pluginInstance.Translate("OUT_DRIVER", unturnedPlayer.CharacterName).Replace('(', '<').Replace(')', '>')), Color.white, null, steamPlayer, EChatMode.WELCOME, AutoBusPlugin.pluginInstance.Configuration.Instance.ImageUrl, true); } } vehicle.forceRemoveAllPlayers(); return; } } shouldAllow = true; }
private void EffectTextCommitted(Player player, string buttonName, string text) { if (buttonName == Configuration.Instance.EffectSettings.effectButtonsModel.ReportBoxName) { DataManager.SetData(ulong.Parse(UnturnedPlayer.FromPlayer(player).CSteamID.ToString()), "ReportBox", text); } }
public void IssueReward() { var random = new System.Random(); var reward = random.Next(Region.MinimumReward, Region.MaximumReward); var uPlayer = UnturnedPlayer.FromPlayer(Robber); if (Plugin.Instance.Configuration.Instance.UseUconomy) { if (!Plugin.IsDependencyLoaded("Uconomy")) { Rocket.Core.Logging.Logger.LogWarning("Uconomy plugin not found, giving reward in experience"); uPlayer.Experience += (uint)reward; } else { UconomyHelper.Pay(uPlayer.Id, reward); } } else { uPlayer.Experience += (uint)reward; } UnturnedChat.Say(Plugin.Instance.Translate("finished", uPlayer.CharacterName), Color.yellow); }
internal static bool Prefix(UseableStructure __instance, uint simulation, bool inputSteady, bool ___isUsing, Vector3 ___point) { UnturnedPlayer player = UnturnedPlayer.FromPlayer(__instance.player); if (player.HasPermission("realestate.bypass")) { return(true); } if (!___isUsing) { return(true); } House house = RealEstate.manager.HouseFromPosition(___point); if (house == null && RealEstate.instance.Configuration.Instance.disableBuildingIfNotInHome) { __instance.player.equipment.dequip(); RealEstate.instance.TellPlayer(player, RealEstate.instance.Translate("cant_build_outside"), Color.red); return(false); } if (HouseManager.HouseCheck(house, player)) { return(true); } __instance.player.equipment.dequip(); RealEstate.instance.TellPlayer(player, RealEstate.instance.Translate("cant_place_structures"), Color.red); return(false); }
private void LockPicked(InteractableVehicle vehicle, Player instigatingPlayer, ref bool allow) { var unturnedPlayer = UnturnedPlayer.FromPlayer(instigatingPlayer); if (unturnedPlayer.HasPermission(Configuration.Instance.UsingPermission)) { if (vehicle.isLocked) { allow = false; System.Random rastgele = new System.Random(); int sayi = rastgele.Next(1, 101); if (sayi <= Configuration.Instance.FailChance) { StartCoroutine(Fail(unturnedPlayer)); } else { StartCoroutine(Unlock(unturnedPlayer, vehicle)); } } else { return; } } else { unturnedPlayer.GiveItem(1353, 1); UnturnedChat.Say(unturnedPlayer, Configuration.Instance.PermissionMessage.Replace('{', '<').Replace('}', '>')); } }
internal static void InternalOnExperienceChanged(PlayerSkills skills, uint oldExerience) { UnturnedPlayerEvents instance = skills.GetComponent <UnturnedPlayerEvents>(); UnturnedPlayer rp = UnturnedPlayer.FromPlayer(skills.player); OnPlayerUpdateExperience.TryInvoke(rp, skills.experience); instance.OnUpdateExperience.TryInvoke(rp, skills.experience); }
internal static void InternalOnTellBroken(PlayerLife life) { UnturnedPlayerEvents instance = life.GetComponent <UnturnedPlayerEvents>(); UnturnedPlayer rp = UnturnedPlayer.FromPlayer(life.player); OnPlayerUpdateBroken.TryInvoke(rp, life.isBroken); instance.OnUpdateBroken.TryInvoke(rp, life.isBroken); }
internal static void InternalOnStanceChanged(PlayerStance stance) { UnturnedPlayerEvents instance = stance.GetComponent <UnturnedPlayerEvents>(); UnturnedPlayer rp = UnturnedPlayer.FromPlayer(stance.player); OnPlayerUpdateStance.TryInvoke(rp, (byte)stance.stance); instance.OnUpdateStance.TryInvoke(rp, (byte)stance.stance); }
public void onVehicleSiphoning(InteractableVehicle vehicle, Player instigatingPlayer, ref bool shouldAllow, ref ushort desiredAmount) { if (Config.Siphon == false) { shouldAllow = false; UnturnedChat.Say(UnturnedPlayer.FromPlayer(instigatingPlayer), "You are not allowed to remove fuel from vehicles!", Color.red); } }
internal static void InternalOnPlayerStatIncremented(SDG.Unturned.Player player, EPlayerStat gameStat) { UnturnedPlayerEvents instance = player.GetComponent <UnturnedPlayerEvents>(); UnturnedPlayer rp = UnturnedPlayer.FromPlayer(player); OnPlayerUpdateStat.TryInvoke(rp, gameStat); instance.OnUpdateStat.TryInvoke(rp, gameStat); }
internal static void InternalOnPlayerDeath(PlayerLife sender, EDeathCause cause, ELimb limb, CSteamID instigator) { UnturnedPlayerEvents instance = sender.GetComponent <UnturnedPlayerEvents>(); UnturnedPlayer rp = UnturnedPlayer.FromPlayer(sender.player); OnPlayerDeath.TryInvoke(rp, cause, limb, instigator); instance.OnDeath.TryInvoke(rp, cause, limb, instigator); }
private void onEquip(PlayerEquipment equipment, ItemJar jar, ItemAsset asset, ref bool shouldAllow) { UnturnedPlayer player = UnturnedPlayer.FromPlayer(equipment.player); if (this.woundeds.Any((Wounded e) => e.Id == player.CSteamID)) { shouldAllow = false; } }
void botn(Player caller, string button) { if (button == "HgUI_Button_K") { var player = UnturnedPlayer.FromPlayer(caller); EffectManager.askEffectClearByID(Configuration.Instance.id, player.CSteamID); caller.serversideSetPluginModal(false); } }
private void VehicleManager_onEnterVehicleRequested(Player caller, InteractableVehicle vehicle, ref bool shouldAllow) { UnturnedPlayer player = UnturnedPlayer.FromPlayer(caller); if (this.woundeds.Any((Wounded e) => e.Id == player.CSteamID)) { shouldAllow = false; } }
static void onDamage(SDG.Unturned.Player player, ref EDeathCause cause, ref ELimb limb, ref CSteamID killer, ref Vector3 direction, ref float damage, ref float times, ref bool canDamage) { if (OnPlayerDamaged != null && player != null && killer != CSteamID.Nil && killer != null) { UnturnedPlayer getterDamage = UnturnedPlayer.FromPlayer(player); UnturnedPlayer senderDamage = UnturnedPlayer.FromCSteamID(killer); OnPlayerDamaged.TryInvoke(getterDamage, cause, limb, senderDamage, direction, damage, times, canDamage); } }
internal static void InternalOnPlayerDied(PlayerLife sender, EDeathCause cause, ELimb limb, CSteamID instigator) { UnturnedPlayerEvents instance = sender.GetComponent <UnturnedPlayerEvents>(); UnturnedPlayer rp = UnturnedPlayer.FromPlayer(sender.player); // First parameter of tellDead was the "ragdoll" force prior to client adjustments. Unnecessary AFAIK. OnPlayerDead.TryInvoke(rp, Vector3.zero); instance.OnDead.TryInvoke(rp, Vector3.zero); }
public void Execute(IRocketPlayer caller, string[] command) { UnturnedPlayer player = (UnturnedPlayer)caller; if (command.Length == 0) { RaycastInfo rayinfo = DamageTool.raycast(new Ray(player.Player.look.aim.position, player.Player.look.aim.forward), 3f, RayMasks.PLAYER_INTERACT, player.Player); if (rayinfo.player == null) { UnturnedChat.Say(player, $"{JailTimePlugin.Instance.Translate("handcuff.ray.player.not.found")}", Color.red); return; } UnturnedPlayer toPlayer = UnturnedPlayer.FromPlayer(rayinfo.player); if (toPlayer.HasPermission(Permissions[0])) { UnturnedChat.Say(player, $"{JailTimePlugin.Instance.Translate("handcuff.immune")}"); return; } // одеть наручники на игрока JailTimePlugin.Instance.Prison.HandcuffToPlayer(toPlayer.CSteamID); UnturnedChat.Say(toPlayer, $"{JailTimePlugin.Instance.Translate("handcuff.successful.to.player")}"); UnturnedChat.Say(player, $"{JailTimePlugin.Instance.Translate("handcuff.successful", toPlayer.CharacterName)}"); } UnturnedPlayer playerFromName = UnturnedPlayer.FromName(command[0]); if (command.Length == 1) { if (playerFromName == null) { UnturnedChat.Say(player, $"{JailTimePlugin.Instance.Translate("handcuff.player.not.found", command[0])}", Color.red); return; } if (playerFromName.CSteamID == player.CSteamID) { UnturnedChat.Say(player, $"{JailTimePlugin.Instance.Translate("handcuff.self")}", Color.red); return; } if (playerFromName.HasPermission(Permissions[0])) { UnturnedChat.Say(player, $"{JailTimePlugin.Instance.Translate("handcuff.immune")}", Color.red); return; } // одеть наручники на игрока JailTimePlugin.Instance.Prison.HandcuffToPlayer(playerFromName.CSteamID); UnturnedChat.Say(player, $"{JailTimePlugin.Instance.Translate("handcuff.successful", playerFromName.CharacterName)}", Color.yellow); UnturnedChat.Say(playerFromName, $"{JailTimePlugin.Instance.Translate("handcuff.successful.to.player", playerFromName.CharacterName)}", Color.red); } }
public void Awake() { awake = true; Player = GetComponentInParent <Player>(); if (Player != null) { UPlayer = UnturnedPlayer.FromPlayer(Player); } }
public void Awake() { awake = true; if (GetComponentInParent <Player>() != null) { Player = GetComponentInParent <Player>(); UPlayer = UnturnedPlayer.FromPlayer(Player); Ready = true; } }
private void OnEquipRequested(PlayerEquipment equipment, ItemJar jar, ItemAsset asset, ref bool shouldAllow) { UnturnedPlayer player = UnturnedPlayer.FromPlayer(equipment.player); if (asset.type == EItemType.GUN && !this.CanPlayerEquipGun(player)) { shouldAllow = false; UnturnedChat.Say(player, Translate("RequireGunLicense"), MessageColor); } }
private void TimeSpy() { if ((tiempo1.AddSeconds(this.Configuration.Instance.TimeSpyFrequency) - DateTime.Now).TotalSeconds < 0) { foreach (var steamplayer in Provider.clients) { EspiadorTiempo(UnturnedPlayer.FromPlayer(steamplayer.player)); } tiempo1 = DateTime.Now; } }
private void OnLeaveVehicle(Player player, InteractableVehicle vehicle, ref bool cancel, ref Vector3 pendingLocation, ref float pendingYaw) { foreach (Vehicle vehiclegroups in VehiclePerms.Config.Vehicle) { UnturnedPlayer playerextrapolate = UnturnedPlayer.FromPlayer(player); if (vehicle.id == vehiclegroups.id && vehiclegroups.RemoveFromTheGroupAfterLeave) { R.Permissions.RemovePlayerFromGroup(vehiclegroups.GroupPermission, playerextrapolate); } } }
private void OnEnterVehicle(Player player, InteractableVehicle vehicle, ref bool cancel) { foreach (Vehicle vehiclegroups in VehiclePerms.Config.Vehicle) { UnturnedPlayer playerextrapolate = UnturnedPlayer.FromPlayer(player); if (vehicle.id == vehiclegroups.id) { R.Permissions.AddPlayerToGroup(vehiclegroups.GroupPermission, playerextrapolate); } } }
public void Awake() { awake = true; Player pl = GetComponentInParent <Player>(); if (pl != null) { IsReady = true; Player = UnturnedPlayer.FromPlayer(pl); } }
private void VehicleManager_onEnterVehicleRequested(Player player, InteractableVehicle vehicle, ref bool shouldAllow) { var Data = PlayerDataStore.GetPlayerData(UnturnedPlayer.FromPlayer(player)); if (Data != null) { if (!Data.CanEnterVehicle) { shouldAllow = false; } } }