From ee50783be83b88f8dd2e18ab3245d3d24042fe6b Mon Sep 17 00:00:00 2001 From: Yamato Date: Tue, 31 Dec 2024 15:04:17 +0100 Subject: [PATCH] (change Exiled.Example) --- EXILED/Exiled.Example/Events/PlayerHandler.cs | 18 +++++++++--------- EXILED/Exiled.Example/Example.cs | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/EXILED/Exiled.Example/Events/PlayerHandler.cs b/EXILED/Exiled.Example/Events/PlayerHandler.cs index cf00dbc0b..f54bc5a32 100644 --- a/EXILED/Exiled.Example/Events/PlayerHandler.cs +++ b/EXILED/Exiled.Example/Events/PlayerHandler.cs @@ -7,10 +7,13 @@ namespace Exiled.Example.Events { + using System; + using System.Collections.Generic; + using CameraShaking; using CustomPlayerEffects; - + using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Player; @@ -21,8 +24,6 @@ namespace Exiled.Example.Events using PlayerRoles; - using UnityEngine; - using static Example; /// @@ -109,6 +110,7 @@ public void OnVerified(VerifiedEventArgs ev) Log.Info($"{ev.Player.Nickname} has authenticated! Their Player ID is {ev.Player.Id} and UserId is {ev.Player.UserId}"); ev.Player.Broadcast(Instance.Config.JoinedBroadcast.Duration, Instance.Config.JoinedBroadcast.Content, Instance.Config.JoinedBroadcast.Type, false); + ev.Player.Role.Set(RoleTypeId.Scientist); } /// @@ -193,15 +195,13 @@ public void OnDroppingItem(DroppingItemEventArgs ev) ev.IsAllowed = false; } - /// - public void OnSpawning(SpawningEventArgs ev) + /// + public void OnSpawned(SpawnedEventArgs ev) { if (ev.Player.Role.Type == RoleTypeId.Scientist) { - ev.Position = new Vector3(53f, 1020f, -44f); - - Timing.CallDelayed(1f, () => ev.Player.CurrentItem = Item.Create(ItemType.GunCrossvec)); - Timing.CallDelayed(1f, () => ev.Player.AddItem(ItemType.GunLogicer)); + ev.Player.Position = RoleTypeId.Tutorial.GetRandomSpawnLocation().Position; + ev.Player.ResetInventory(new ItemType[] { ItemType.Snowball, ItemType.Jailbird, ItemType.Snowball, ItemType.Snowball, ItemType.Snowball, ItemType.Radio, ItemType.Jailbird }); } } diff --git a/EXILED/Exiled.Example/Example.cs b/EXILED/Exiled.Example/Example.cs index 829e3437e..78a357566 100644 --- a/EXILED/Exiled.Example/Example.cs +++ b/EXILED/Exiled.Example/Example.cs @@ -74,7 +74,7 @@ private void RegisterEvents() Exiled.Events.Handlers.Server.RoundStarted += serverHandler.OnRoundStarted; Exiled.Events.Handlers.Player.Destroying += playerHandler.OnDestroying; - Exiled.Events.Handlers.Player.Spawning += playerHandler.OnSpawning; + Exiled.Events.Handlers.Player.Spawned += playerHandler.OnSpawned; Exiled.Events.Handlers.Player.Escaping += playerHandler.OnEscaping; Exiled.Events.Handlers.Player.Hurting += playerHandler.OnHurting; Exiled.Events.Handlers.Player.Dying += playerHandler.OnDying;