11using System ;
22using System . Diagnostics . CodeAnalysis ;
3+ using System . Numerics ;
34using System . Runtime . InteropServices ;
45using System . Threading . Tasks ;
56using AltV . Net . Data ;
67using AltV . Net . Elements . Args ;
78using AltV . Net . Elements . Entities ;
9+ using AltV . Net . Enums ;
810using AltV . Net . Native ;
911using AltV . Net . Shared . Elements . Entities ;
1012using AltV . Net . Shared . Utils ;
@@ -615,6 +617,15 @@ public void SetWeather(uint weather)
615617 }
616618 }
617619
620+ public void SetWeather ( WeatherType weatherType )
621+ {
622+ lock ( Player )
623+ {
624+ if ( ! AsyncContext . CheckIfExistsNullable ( Player ) ) return ;
625+ Player . SetWeather ( weatherType ) ;
626+ }
627+ }
628+
618629 public void GiveWeapon ( uint weapon , int ammo , bool selectWeapon )
619630 {
620631 lock ( Player )
@@ -624,6 +635,15 @@ public void GiveWeapon(uint weapon, int ammo, bool selectWeapon)
624635 }
625636 }
626637
638+ public void GiveWeapon ( WeaponModel weaponModel , int ammo , bool selectWeapon )
639+ {
640+ lock ( Player )
641+ {
642+ if ( ! AsyncContext . CheckIfExistsNullable ( Player ) ) return ;
643+ Player . GiveWeapon ( weaponModel , ammo , selectWeapon ) ;
644+ }
645+ }
646+
627647 public bool RemoveWeapon ( uint weapon )
628648 {
629649 lock ( Player )
@@ -633,6 +653,15 @@ public bool RemoveWeapon(uint weapon)
633653 }
634654 }
635655
656+ public bool RemoveWeapon ( WeaponModel weaponModel )
657+ {
658+ lock ( Player )
659+ {
660+ if ( ! AsyncContext . CheckIfExistsNullable ( Player ) ) return false ;
661+ return Player . RemoveWeapon ( weaponModel ) ;
662+ }
663+ }
664+
636665 public void RemoveAllWeapons ( bool removeAllAmmo )
637666 {
638667 lock ( Player )
@@ -651,6 +680,15 @@ public bool HasWeapon(uint weapon)
651680 }
652681 }
653682
683+ public bool HasWeapon ( WeaponModel weapon )
684+ {
685+ lock ( Player )
686+ {
687+ if ( ! AsyncContext . CheckIfExistsNullable ( Player ) ) return default ;
688+ return Player . HasWeapon ( weapon ) ;
689+ }
690+ }
691+
654692 public void Kick ( string reason )
655693 {
656694 lock ( Player )
@@ -760,6 +798,15 @@ public void AddWeaponComponent(uint weapon, uint weaponComponent)
760798 }
761799 }
762800
801+ public void AddWeaponComponent ( WeaponModel weaponModel , uint weaponComponent )
802+ {
803+ lock ( Player )
804+ {
805+ if ( ! AsyncContext . CheckIfExistsNullable ( Player ) ) return ;
806+ Player . AddWeaponComponent ( weaponModel , weaponComponent ) ;
807+ }
808+ }
809+
763810 public void RemoveWeaponComponent ( uint weapon , uint weaponComponent )
764811 {
765812 lock ( Player )
@@ -769,6 +816,15 @@ public void RemoveWeaponComponent(uint weapon, uint weaponComponent)
769816 }
770817 }
771818
819+ public void RemoveWeaponComponent ( WeaponModel weaponModel , uint weaponComponent )
820+ {
821+ lock ( Player )
822+ {
823+ if ( ! AsyncContext . CheckIfExistsNullable ( Player ) ) return ;
824+ Player . RemoveWeaponComponent ( weaponModel , weaponComponent ) ;
825+ }
826+ }
827+
772828 public bool HasWeaponComponent ( uint weapon , uint weaponComponent )
773829 {
774830 lock ( Player )
@@ -778,6 +834,15 @@ public bool HasWeaponComponent(uint weapon, uint weaponComponent)
778834 }
779835 }
780836
837+ public bool HasWeaponComponent ( WeaponModel weapon , uint weaponComponent )
838+ {
839+ lock ( Player )
840+ {
841+ if ( ! AsyncContext . CheckIfExistsNullable ( Player ) ) return false ;
842+ return Player . HasWeaponComponent ( weapon , weaponComponent ) ;
843+ }
844+ }
845+
781846 public void GetCurrentWeaponComponents ( out uint [ ] weaponComponents )
782847 {
783848 lock ( Player )
@@ -813,6 +878,15 @@ public void SetWeaponTintIndex(uint weapon, byte tintIndex)
813878 }
814879 }
815880
881+ public void SetWeaponTintIndex ( WeaponModel weaponModel , byte tintIndex )
882+ {
883+ lock ( Player )
884+ {
885+ if ( ! AsyncContext . CheckIfExistsNullable ( Player ) ) return ;
886+ Player . SetWeaponTintIndex ( weaponModel , tintIndex ) ;
887+ }
888+ }
889+
816890 public byte GetWeaponTintIndex ( uint weapon )
817891 {
818892 lock ( Player )
@@ -822,6 +896,15 @@ public byte GetWeaponTintIndex(uint weapon)
822896 }
823897 }
824898
899+ public byte GetWeaponTintIndex ( WeaponModel weapon )
900+ {
901+ lock ( Player )
902+ {
903+ if ( ! AsyncContext . CheckIfExistsNullable ( Player ) ) return default ;
904+ return Player . GetWeaponTintIndex ( weapon ) ;
905+ }
906+ }
907+
825908 public byte GetCurrentWeaponTintIndex ( )
826909 {
827910 lock ( Player )
@@ -1275,6 +1358,31 @@ public void GetLocalMetaData(string key, out MValueConst value)
12751358 }
12761359 }
12771360
1361+ public bool GetLocalMetaData < T > ( string key , out T result )
1362+ {
1363+ lock ( Player )
1364+ {
1365+ if ( ! AsyncContext . CheckIfExistsNullable ( Player ) )
1366+ {
1367+ result = default ;
1368+ return false ;
1369+ }
1370+ return Player . GetLocalMetaData ( key , out result ) ;
1371+ }
1372+ }
1373+
1374+ public void SetLocalMetaData ( string key , object value )
1375+ {
1376+ lock ( Player )
1377+ {
1378+ if ( ! AsyncContext . CheckIfExistsNullable ( Player ) )
1379+ {
1380+ return ;
1381+ }
1382+ Player . SetLocalMetaData ( key , value ) ;
1383+ }
1384+ }
1385+
12781386 public void SetLocalMetaData ( string key , in MValueConst value )
12791387 {
12801388 lock ( Player )
@@ -1571,6 +1679,15 @@ public string BloodDamage
15711679 }
15721680 }
15731681
1682+ public Vector3 GetForwardVector ( )
1683+ {
1684+ lock ( Player )
1685+ {
1686+ if ( ! AsyncContext . CheckIfExistsOrCachedNullable ( Player ) ) return default ;
1687+ return Player . GetForwardVector ( ) ;
1688+ }
1689+ }
1690+
15741691 [ Obsolete ( "Use new async API instead" ) ]
15751692 public IPlayer ToAsync ( IAsyncContext asyncContext )
15761693 {
0 commit comments