File tree Expand file tree Collapse file tree 1 file changed +15
-19
lines changed
EXILED/Exiled.CustomRoles/API/Features Expand file tree Collapse file tree 1 file changed +15
-19
lines changed Original file line number Diff line number Diff line change @@ -539,6 +539,21 @@ public virtual void AddRole(Player player)
539
539
}
540
540
} ) ;
541
541
542
+ if ( Ammo . Count > 0 )
543
+ {
544
+ Timing . CallDelayed (
545
+ 0.5f ,
546
+ ( ) =>
547
+ {
548
+ Log . Debug ( $ "{ Name } : Adding Ammo to { player . Nickname } inventory.") ;
549
+ foreach ( AmmoType type in Enum . GetValues ( typeof ( AmmoType ) ) )
550
+ {
551
+ if ( type != AmmoType . None )
552
+ player . SetAmmo ( type , Ammo . ContainsKey ( type ) ? Ammo [ type ] == ushort . MaxValue ? InventoryLimits . GetAmmoLimit ( type . GetItemType ( ) , player . ReferenceHub ) : Ammo [ type ] : ( ushort ) 0 ) ;
553
+ }
554
+ } ) ;
555
+ }
556
+
542
557
Log . Debug ( $ "{ Name } : Setting health values.") ;
543
558
player . Health = MaxHealth ;
544
559
player . MaxHealth = MaxHealth ;
@@ -910,25 +925,6 @@ private void OnInternalChangingRole(ChangingRoleEventArgs ev)
910
925
{
911
926
RemoveRole ( ev . Player ) ;
912
927
}
913
- else if ( Check ( ev . Player ) )
914
- {
915
- Log . Debug ( $ "{ Name } : Checking ammo stuff { Ammo . Count } ") ;
916
- if ( Ammo . Count > 0 )
917
- {
918
- Log . Debug ( $ "{ Name } : Clearing ammo") ;
919
- ev . Ammo . Clear ( ) ;
920
- Timing . CallDelayed (
921
- 0.5f ,
922
- ( ) =>
923
- {
924
- foreach ( AmmoType type in Enum . GetValues ( typeof ( AmmoType ) ) )
925
- {
926
- if ( type != AmmoType . None )
927
- ev . Player . SetAmmo ( type , Ammo . ContainsKey ( type ) ? Ammo [ type ] == ushort . MaxValue ? InventoryLimits . GetAmmoLimit ( type . GetItemType ( ) , ev . Player . ReferenceHub ) : Ammo [ type ] : ( ushort ) 0 ) ;
928
- }
929
- } ) ;
930
- }
931
- }
932
928
}
933
929
934
930
private void OnSpawningRagdoll ( SpawningRagdollEventArgs ev )
You can’t perform that action at this time.
0 commit comments