55using System . Collections . Generic ;
66using UnityEngine ;
77using MEC ;
8- using Exiled . API . Features . Pickups ;
9- using System . Linq ;
8+ using Exiled . Events . EventArgs . Player ;
109
1110namespace TestingDummies . SpawningHandler
1211{
@@ -15,13 +14,14 @@ public class Spawn : MonoBehaviour
1514 readonly int IDs = 1000 ;
1615 public Dictionary < Player , GameObject > PlayerPrefabs = new ( ) ;
1716 public Dictionary < Player , FakeConnection > PlayerConnIDs = new ( ) ;
17+
1818 public IEnumerator < float > SpawnDum ( string Name , RoleTypeId Role , Player target )
1919 {
2020 GameObject newPlayer = Instantiate ( NetworkManager . singleton . playerPrefab ) ;
21- Player NewPlayer = new ( newPlayer ) ;
21+ Player NewPlayer = new ( newPlayer ) ;
2222 PlayerPrefabs . Add ( NewPlayer , newPlayer ) ;
2323 var fakeConnection = new FakeConnection ( IDs + Plugin . Instance . DumRef . Count ) ;
24- ReferenceHub hubPlayer = newPlayer . GetComponent < ReferenceHub > ( ) ;
24+ ReferenceHub hubPlayer = NewPlayer . ReferenceHub ;
2525 Plugin . Instance . DumRef . Add ( hubPlayer ) ;
2626 NetworkServer . AddPlayerForConnection ( fakeConnection , newPlayer ) ;
2727 PlayerConnIDs . Add ( NewPlayer , fakeConnection ) ;
@@ -33,8 +33,8 @@ public IEnumerator<float> SpawnDum(string Name, RoleTypeId Role, Player target)
3333 {
3434 Log . Debug ( e ) ;
3535 }
36- hubPlayer . enabled = true ;
3736 hubPlayer . nicknameSync . Network_myNickSync = $ "{ Name } -{ Plugin . Instance . DumRef . Count } ";
37+ hubPlayer . serverRoles . DoNotTrack = true ;
3838 Player . Dictionary . Add ( newPlayer , NewPlayer ) ;
3939 if ( Plugin . Instance . Config . NPCBadgeEnabled )
4040 {
@@ -47,6 +47,8 @@ public IEnumerator<float> SpawnDum(string Name, RoleTypeId Role, Player target)
4747 NewPlayer . Role . Set ( Role , Exiled . API . Enums . SpawnReason . ForceClass ) ;
4848 NewPlayer . Position = target . Position ;
4949 NewPlayer . SessionVariables . Add ( "npc" , true ) ;
50+ VerifiedEventArgs newVerified = new ( NewPlayer ) ;
51+ Exiled . Events . Handlers . Player . OnVerified ( newVerified ) ;
5052 yield break ;
5153 }
5254 }
0 commit comments