/*check if arena spawn or others */ public IEnumerator getArenaState() { while (true) { if (Provider.isServer) { switch (LevelManager.arenaState) { case EArenaState.WARMUP: { /* using experimental on hurt */ if (Instance.Configuration.Instance.Fallprotect) { Warmup = true; if (GG != null) { try { StopCoroutine(GG); } catch { } } GG = StartCoroutine(gamer()); /* using experimental on hurt */ } } break; case EArenaState.INTERMISSION: { buffer = 5; Warmup = false; } break; /* case EArenaState.RESTART: * { * for (int i = 0; i < LevelManager.arenaPlayers.Count; i++) * { * ArenaPlayer item = LevelManager.arenaPlayers[i]; * UnturnedPlayer item2 = UnturnedPlayer.FromSteamPlayer(item.steamPlayer); * if (!item.hasDied && item.steamPlayer != null && !(item.steamPlayer.player == null)) * { * Instance.PointDB.AddPoints(item2.CSteamID.ToString(), Instance.Configuration.Instance.firstpoint); * UnturnedChat.Say("[Tourney]\n"+item+" Got 1st place and won \n"+ Instance.Configuration.Instance.firstpoint+" point(s)!\n[Tourney]", Color.blue); * } * } * } * break; */ case EArenaState.SPAWN: { foreach (var id in FilterData.FilterData.Instance.Configuration.Instance.Casters) { CSteamID L = id; UnturnedPlayer unPlayer = UnturnedPlayer.FromCSteamID(id); unPlayer.Features.GodMode = false; unPlayer.Damage(101, Vector3.up * 101f, EDeathCause.KILL, ELimb.SKULL, L); } } break; } } } }
//Check for win. public void checkWin() { //Count and deal with alive people. int tempTotalAlive = aliveCount(); Logger.Log("Paintball Current Alive: " + tempTotalAlive); alive = tempTotalAlive; if (tempTotalAlive == 1) { var winningPlayer = PaintballManager.joinedPlayers.FirstOrDefault(item => item.getDead() == false); UnturnedPlayer playerWinner = winningPlayer.getPlayer(); //Increase wins. playerWins[playerWinner.CSteamID]++; PlayerManager.clearInventory(playerWinner); playerWinner.Damage(255, new Vector3(0, 0, 0), EDeathCause.PUNCH, ELimb.SKULL, playerWinner.CSteamID); UnturnedChat.Say("The paintball winner this round is: " + playerWinner.CharacterName + "!", Color.cyan); //Called when the current game naturally ends. PaintballManager.gameRunning = false; } }
public void Execute(IRocketPlayer caller, string[] command) { if (command.Count() == 1) { string playerName = command[0]; //Find player foreach (SteamPlayer plr in Provider.Players) { //So let's convert each SteamPlayer into an UnturnedPlayer UnturnedPlayer unturnedPlayer = UnturnedPlayer.FromSteamPlayer(plr); if (unturnedPlayer.DisplayName.ToLower().IndexOf(playerName.ToLower()) != -1 || unturnedPlayer.CharacterName.ToLower().IndexOf(playerName.ToLower()) != -1 || unturnedPlayer.SteamName.ToLower().IndexOf(playerName.ToLower()) != -1 || unturnedPlayer.CSteamID.ToString().Equals(playerName)) { unturnedPlayer.Damage(200, unturnedPlayer.Position, EDeathCause.KILL, ELimb.LEFT_BACK, unturnedPlayer.CSteamID); UnturnedChat.Say(caller, "Killed " + unturnedPlayer.DisplayName + ".", Color.green); return; } } UnturnedChat.Say(caller, "Player not found.", Color.red); } else { UnturnedChat.Say(caller, "Error.", Color.red); return; } }
public override void OnRegionLeave(UnturnedPlayer player) { int health = player.Health; if (_lastHealth.ContainsKey(player.CSteamID.m_SteamID)) { health = _lastHealth[player.CSteamID.m_SteamID]; _lastHealth.Remove(player.CSteamID.m_SteamID); } player.Features.GodMode = false; if (!GetValueSafe(Region.GetGroup(player))) { return; } var currentHealth = player.Health; if (currentHealth < health) { player.Heal((byte)(health - currentHealth)); } else { player.Damage((byte)(currentHealth - health), Vector3.zero, EDeathCause.KILL, ELimb.SPINE, CSteamID.Nil); } }
private void Events_OnPlayerConnected(UnturnedPlayer player) { if (this.willDeads.Any((CSteamID e) => e == player.CSteamID)) { player.Damage(byte.MaxValue, player.Position, 0, ELimb.SKULL, CSteamID.Nil); this.willDeads.Remove(player.CSteamID); } PlayerEquipment equipment = player.Player.equipment; equipment.onEquipRequested = (PlayerEquipRequestHandler)Delegate.Combine(equipment.onEquipRequested, new PlayerEquipRequestHandler(this.onEquip)); }
public void Execute(IRocketPlayer caller, string[] command) { UnturnedPlayer player = caller as UnturnedPlayer; if (Main.instance.woundeds.Any((Wounded e) => e.Id == player.CSteamID)) { player.Damage(byte.MaxValue, player.Position, 0, ELimb.SKULL, CSteamID.Nil); UnturnedChat.Say(player, "İntihar ettin.", Color.red); return; } UnturnedChat.Say(player, "Şu an intihar edemezsin.", Color.red); }
/** * Adds a combat logger to the list, prints their name to the server console, * "Kills" the player so they drop their loot, and prints the combat loggers * name to the global chat if configured to do so. */ private void ProcessCombatLogger(UnturnedPlayer _player) { AddPlayerToCombatLoggersList(_player.CSteamID); ShowCombatLoggerToConsole(_player); _player.Damage(255, _player.Position, EDeathCause.PUNCH, ELimb.SKULL, _player.CSteamID); //Drop player items. if (this.Configuration.Instance.ShowCombatLogMessagesToGlobalChat) { ShowCombatLoggerMessageToChat(_player); } }
public void join(UnturnedPlayer tempPlayer) { //Check for duplicate player and group. int checkResult = PlayerManager.duplicatePlayerGroupCheck(tempPlayer); if (checkResult == 0 || checkResult == 1) { return; } //If they're driving, have them get out first. if (tempPlayer.Stance == EPlayerStance.DRIVING || tempPlayer.Stance == EPlayerStance.SITTING) { UnturnedChat.Say(tempPlayer, "Please exit the vehicle then try to join paintball.", Color.red); return; } //Player passed check, create PlayerManager object. PlayerManager playerObj = new PlayerManager(tempPlayer); //Add player to joined list. PaintballManager.joinedPlayers.Add(playerObj); //Set their permissions. Rocket.Core.R.Permissions.AddPlayerToGroup("EventGroup", tempPlayer); Rocket.Core.R.Permissions.RemovePlayerFromGroup("Guest", tempPlayer); //Save inventory and clear player. playerObj.saveAndClearInventory(); //Add them to reward list if they aren't there already. if (!PaintballManager.playerWins.ContainsKey(tempPlayer.CSteamID)) { PaintballManager.playerWins.Add(tempPlayer.CSteamID, 0); } //Notify player of joining. UnturnedChat.Say(tempPlayer, "You have joined paintball!", Color.green); if (PaintballManager.gameRunning) { tempPlayer.Damage(255, new Vector3(0, 0, 0), EDeathCause.PUNCH, ELimb.SKULL, tempPlayer.CSteamID); return; } //Send player to waiting room (waiting) and activate god for waitroom. tempPlayer.Teleport(PaintballManager.waitingPosition, PaintballManager.waitingRotation); tempPlayer.GodMode = true; return; }
public void Öldür(CSteamID id) { UnturnedPlayer player = UnturnedPlayer.FromCSteamID(id); if (player != null) { player.Damage(byte.MaxValue, player.Position, 0, ELimb.SKULL, player.CSteamID); this.Temizle(player); player.Player.movement.sendPluginSpeedMultiplier(1f); } if (this.woundeds.Any((Wounded e) => e.Id == player.CSteamID)) { this.woundeds.Remove(this.woundeds.First((Wounded e) => e.Id == player.CSteamID)); } }
public override void OnRegionLeave(UnturnedPlayer player) { int health = player.Health; if (_lastHealth.ContainsKey(player.CSteamID.m_SteamID)) { health = _lastHealth[player.CSteamID.m_SteamID]; _lastHealth.Remove(player.CSteamID.m_SteamID); } player.Features.GodMode = false; if (!GetValueSafe(Region.GetGroup(player))) return; var currentHealth = player.Health; if (currentHealth < health) { player.Heal((byte)(health - currentHealth)); } else { player.Damage((byte)(currentHealth - health), Vector3.zero, EDeathCause.KILL, ELimb.SPINE, CSteamID.Nil); } }
public override void OnRegionLeave(UnturnedPlayer player) { int health = player.Health; if (_lastHealth.ContainsKey(player.CSteamID.m_SteamID)) { health = _lastHealth[player.CSteamID.m_SteamID]; _lastHealth.Remove(player.CSteamID.m_SteamID); } player.Features.GodMode = false; if (!GetValueSafe(Region.GetGroup(player))) { return; } if (_isBleed.ContainsKey(player.CSteamID.m_SteamID)) { _isBleed.Remove(player.CSteamID.m_SteamID); player.Bleeding = true; } else { player.Bleeding = false; // Just incase they're bleed while they're coming out of region. } var currentHealth = player.Health; if (currentHealth < health) { player.Heal((byte)(health - currentHealth)); } else { player.Damage((byte)(currentHealth - health), Vector3.zero, EDeathCause.KILL, ELimb.SPINE, CSteamID.Nil); } }
//Fixed Update public void FixedUpdate() { if (this.State == PluginState.Loaded && players != null && players.Count != 0) { foreach (KeyValuePair <string, Sentence> pl in players) { if (pl.Value.End <= DateTime.Now) { try { removePlayer(null, pl.Key); break; } catch { } } try { UnturnedPlayer player = UnturnedPlayer.FromCSteamID(new CSteamID(Convert.ToUInt64(pl.Key))); if (player != null && Vector3.Distance(player.Position, pl.Value.Cell.Location) > Configuration.Instance.WalkDistance) { if (Configuration.Instance.KillInsteadOfTeleport) { player.Damage(255, player.Position, EDeathCause.PUNCH, ELimb.SKULL, player.CSteamID); } else { player.Teleport(pl.Value.Cell.Location, player.Rotation); } } } catch { } } } }
/** * Adds a combat logger to the list, prints their name to the server console, * "Kills" the player so they drop their loot, and prints the combat loggers * name to the global chat if configured to do so. */ private void ProcessCombatLogger(UnturnedPlayer _player) { if (_player.HasPermission("nocl") || _player.IsAdmin) { return; //Break out early if the player is exempt from combat logging rules. } AddPlayerToCombatLoggersList(_player.CSteamID); ShowCombatLoggerToConsole(_player); if (this.Configuration.Instance.ShowCombatLogMessagesToGlobalChat) { ShowCombatLoggerMessageToChat(_player); } if (this.Configuration.Instance.DropItemsOnDisconnect) { _player.Damage(255, _player.Position, EDeathCause.PUNCH, ELimb.SKULL, _player.CSteamID); //Drop player items. } if (this.Configuration.Instance.DeleteInventoryOnDisconnect) { DeleteLastUsedPlayerData(_player.CSteamID); } }
public void dealWithWinEvent() { //Count and deal with alive people. int tempTotalAlive = AliveCount(); Logger.Log("Alive count: " + tempTotalAlive); if (tempTotalAlive == 1) { var winningPlayer = CommandEvent.joinedPlayers.FirstOrDefault(item => item.getDead() == false); winners += winningPlayer.getSteamID() + " "; winningPlayer.increaseWins(); UnturnedPlayer playerWinner = UnturnedPlayer.FromCSteamID(new CSteamID(Convert.ToUInt64(winningPlayer.getSteamID()))); CommandEvent myEvent = new CommandEvent(); myEvent.clearInventory(playerWinner); playerWinner.Damage(255, new Vector3(0, 0, 0), EDeathCause.PUNCH, ELimb.SKULL, playerWinner.CSteamID); // playerWinner.Teleport(CommandEvent.position2, 0); // playerWinner.GodMode = true; // winningPlayer.setDead(true); UnturnedChat.Say(Events.Instance.Translate("events_winner_announcement", winningPlayer.getName()), Events.Instance.Configuration.Instance.AnnouncementColor); // CommandEvent.eventActive = false; } }
public void Execute(UnturnedPlayer caller, string[] command) { //save the caller state PlayerState playerState = PlayerState.getState(caller); PlayerState.clearInventory(caller); //respawn and restore the player on death and revival, respectively LifeUpdated playerDied = null; playerDied = delegate (bool isDead) { if (isDead) { LifeUpdated playerRevived = null; playerRevived = delegate (bool isDead2) { if (!isDead2) { playerState.setSkills(caller); playerState.setStats(caller); playerState.setInventory(caller); } caller.Player.PlayerLife.OnUpdateLife -= playerRevived; }; caller.Player.PlayerLife.OnUpdateLife += playerRevived; DGPlugin.respawnPlayer(caller); } caller.Player.PlayerLife.OnUpdateLife -= playerDied; }; caller.Player.PlayerLife.OnUpdateLife += playerDied; //kill the caller caller.Damage(100, new Vector3(), EDeathCause.KILL, ELimb.SPINE, caller.CSteamID); }
private void Execute(UnturnedPlayer player, UnturnedPlayer killer) { killer.Damage(255, player.Position, EDeathCause.PUNCH, ELimb.SKULL, killer.CSteamID); }
public void setStats(UnturnedPlayer player) { player.Hunger = (byte) (100 - hunger); player.Infection = (byte) (100 - infection); player.Thirst = (byte) (100 - thirst); var healthDiff = health - player.Health; if (healthDiff > 0) player.Heal((byte) healthDiff); else if (healthDiff < 0) player.Damage((byte) -healthDiff, new Vector3(), EDeathCause.KILL, ELimb.SPINE, player.CSteamID); player.Bleeding = bleeding; player.Broken = broken; }