Extern methods without using of the Native static class.

This commit is contained in:
Kernell 2016-01-06 21:06:22 +03:00
parent 89ce28931f
commit 164310084c
14 changed files with 645 additions and 1313 deletions

View File

@ -7,10 +7,8 @@ namespace MultiTheftAuto
{ {
public class Account : Element public class Account : Element
{ {
public Account( UInt32 userdata ) public Account()
: base( userdata )
{ {
} }
} }
} }

View File

@ -8,8 +8,7 @@ namespace MultiTheftAuto
{ {
public class Ban : Element public class Ban : Element
{ {
public Ban( UInt32 userdata ) internal Ban()
: base( userdata )
{ {
} }
} }

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Runtime.CompilerServices;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -79,81 +80,53 @@ namespace MultiTheftAuto
{ {
#region Constructors #region Constructors
public Blip( Vector3 position, BlipIcon icon = BlipIcon.None, int size = 2, Color color = null, int ordering = 0, float visibleDistance = 99999.0f, Element visibleTo = null ) [MethodImpl( MethodImplOptions.InternalCall )]
: base( Native.Blip.Create( position, (int)icon, size, color, ordering, visibleDistance, visibleTo != null ? visibleTo.userdata : 0 ) ) public extern Blip( Vector3 position, BlipIcon icon = BlipIcon.None, int size = 2, Color color = null, int ordering = 0, float visibleDistance = 99999.0f, Element visibleTo = null );
[MethodImpl( MethodImplOptions.InternalCall )]
public extern Blip( Element element, BlipIcon icon = BlipIcon.None, int size = 2, Color color = null, int ordering = 0, float visibleDistance = 99999.0f, Element visibleTo = null );
internal Blip()
{ {
}
public Blip( Element element, BlipIcon icon = BlipIcon.None, int size = 2, Color color = null, int ordering = 0, float visibleDistance = 99999.0f, Element visibleTo = null )
: base( Native.Blip.CreateAttachedTo( element.userdata, (int)icon, size, color, ordering, visibleDistance, visibleTo != null ? visibleTo.userdata : 0 ) )
{
}
public Blip( UInt32 userdata )
: base( userdata )
{
} }
#endregion #endregion
#region Get functions #region Get functions
public int GetIcon() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetIcon();
return Native.Blip.GetIcon( this.userdata );
}
public int GetSize() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetSize();
return Native.Blip.GetSize( this.userdata );
}
public Color GetColor() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Color GetColor();
return Native.Blip.GetColor( this.userdata );
}
public int GetOrdering() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetOrdering();
return Native.Blip.GetOrdering( this.userdata );
}
public float GetVisibleDistance() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern float GetVisibleDistance();
return Native.Blip.GetVisibleDistance( this.userdata );
}
#endregion #endregion
#region Set functions #region Set functions
public bool SetIcon( int icon ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetIcon( int icon );
return Native.Blip.SetIcon( this.userdata, icon );
}
public bool SetSize( int size ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetSize( int size );
return Native.Blip.SetSize( this.userdata, size );
}
public bool SetColor( Color color ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetColor( Color color );
return Native.Blip.SetColor( this.userdata, color );
}
public bool SetOrdering( int ordering ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetOrdering( int ordering );
return Native.Blip.SetOrdering( this.userdata, ordering );
}
public bool SetVisibleDistance( float distance ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetVisibleDistance( float distance );
return Native.Blip.SetVisibleDistance( this.userdata, distance );
}
#endregion #endregion
} }

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Runtime.CompilerServices;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -8,64 +9,44 @@ namespace MultiTheftAuto
{ {
public class ColShape : Element public class ColShape : Element
{ {
public ColShape( UInt32 userdata ) public ColShape()
: base( userdata )
{ {
} }
} }
public class ColCircle : ColShape public class ColCircle : ColShape
{ {
public ColCircle( float x, float y, float radius ) [MethodImpl( MethodImplOptions.InternalCall )]
: base( Native.ColShape.CreateCircle( x, y, radius ) ) public extern ColCircle( Vector2 position, float radius );
{
}
} }
public class ColCuboid : ColShape public class ColCuboid : ColShape
{ {
public ColCuboid( float x, float y, float z, float width, float depth, float height ) [MethodImpl( MethodImplOptions.InternalCall )]
: base( Native.ColShape.CreateCuboid( x, y, z, width, depth, height ) ) public extern ColCuboid( Vector3 position, Vector3 size );
{
}
} }
public class ColSphere : ColShape public class ColSphere : ColShape
{ {
public ColSphere( float x, float y, float z, float fadius ) [MethodImpl( MethodImplOptions.InternalCall )]
: base( Native.ColShape.CreateSphere( x, y, z, fadius ) ) public extern ColSphere( Vector3 position, float fadius );
{
}
} }
public class ColRectangle : ColShape public class ColRectangle : ColShape
{ {
public ColRectangle( float x, float y, float width, float height ) [MethodImpl( MethodImplOptions.InternalCall )]
: base( Native.ColShape.CreateRectangle( x, y, width, height ) ) public extern ColRectangle( Vector2 position, Vector2 size );
{
}
} }
public class ColPolygon : ColShape public class ColPolygon : ColShape
{ {
public ColPolygon( float x, float y, float x1, float y1, float x2, float y2, float x3, float y3, params float[] args ) [MethodImpl( MethodImplOptions.InternalCall )]
: base( Native.ColShape.CreatePolygon( x, y, x1, y1, x2, y2, x3, y3, args ) ) public extern ColPolygon( Vector2 pos1, Vector2 pos2, Vector2 pos3, Vector2 pos4, params Vector2[] args );
{
}
} }
public class ColTube : ColShape public class ColTube : ColShape
{ {
public ColTube( float x, float y, float z, float radius, float height ) [MethodImpl( MethodImplOptions.InternalCall )]
: base( Native.ColShape.CreateTube( x, y, z, radius, height ) ) public extern ColTube( Vector3 position, float radius, float height );
{
}
} }
} }

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Runtime.CompilerServices;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -8,15 +9,12 @@ namespace MultiTheftAuto
{ {
public class Console : Player public class Console : Player
{ {
public Console( uint userdata ) : private Console()
base( userdata )
{ {
} }
public static bool Output( string text, Element element = null ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public static extern bool Output( string text, Element element = null );
return Native.Server.OutputConsole( text, element == null ? Element.Root.userdata : element.userdata );
}
public static int Read() public static int Read()
{ {
@ -38,14 +36,20 @@ namespace MultiTheftAuto
return System.Console.ReadLine(); return System.Console.ReadLine();
} }
public static bool Write( string message, params string[] args ) [MethodImpl( MethodImplOptions.InternalCall )]
private static extern void Write( string message );
[MethodImpl( MethodImplOptions.InternalCall )]
private static extern void WriteLine( string message );
public static void Write( string message, params object[] args )
{ {
return Native.Server.OutputServerLog( string.Format( message, args ) ); Write( String.Format( message, args ) );
} }
public static bool WriteLine( string message, params string[] args ) public static void WriteLine( string message, params object[] args )
{ {
return Native.Server.OutputServerLog( string.Format( message, args ) ); WriteLine( String.Format( message, args ) );
} }
} }
} }

View File

@ -1,33 +1,20 @@
using System; using System;
using System.Runtime.CompilerServices;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using MultiTheftAuto.EventArgs; using MultiTheftAuto.EventArgs;
using MultiTheftAuto.Pools;
using MultiTheftAuto.Utils;
namespace MultiTheftAuto namespace MultiTheftAuto
{ {
public class Element : IdentifiedPool<Element>, IIdentifyable public class Element
{ {
#region Properties
public UInt32 userdata
{
get;
private set;
}
#endregion
#region Static properties #region Static properties
public static Element Root public static Element Root
{ {
get get
{ {
UInt32 userdata = Native.Element.GetRootElement(); return Element.GetRootElement();
return userdata != 0 ? Element.FindOrCreate( userdata ) : null;
} }
} }
@ -35,16 +22,16 @@ namespace MultiTheftAuto
#region Constructors #region Constructors
public Element( UInt32 userdata ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Element( string type, string ID );
this.userdata = userdata;
FindOrCreate( userdata ); internal Element()
{
} }
public Element( string type, string ID ) ~Element()
: this( Native.Element.Create( type, ID ) )
{ {
Debug.Info( "~Element() [0x" + this + "]" );
} }
#endregion #endregion
@ -53,282 +40,172 @@ namespace MultiTheftAuto
#region Set #region Set
public bool Destroy() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool Destroy();
bool result = Native.Element.Destroy( this.userdata );
if( result ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Element Clone( Vector3 position = null, bool cloneChildren = false );
this.userdata = 0;
this.Dispose(); [MethodImpl( MethodImplOptions.InternalCall )]
} public extern bool ClearElementVisibleTo();
return result; [MethodImpl( MethodImplOptions.InternalCall )]
} public extern bool SetID( string id );
public Element Clone( Vector3 position = null, bool cloneChildren = false ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetData( string key, string value, bool sync = true );
return Element.FindOrCreate( Native.Element.Clone( this.userdata, position, cloneChildren ) );
}
public bool ClearElementVisibleTo() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool RemoveData( string key );
return Native.Element.ClearElementVisibleTo( this.userdata );
}
public bool SetID( string id ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetParent( Element parent );
return Native.Element.SetID( this.userdata, id );
}
public bool SetData( string key, string value, bool sync = true ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetPosition( Vector3 position, bool warp = true );
return Native.Element.SetData( this.userdata, key, value, sync );
}
public bool RemoveData( string key ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetRotation( Vector3 rotation, string order = "default", bool pedRotation = false );
return Native.Element.RemoveData( this.userdata, key );
}
public bool SetParent( UInt32 parent ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetVelocity( Vector3 velocity );
return Native.Element.SetParent( this.userdata, parent );
}
public bool SetPosition( Vector3 position, bool warp = true ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetVisibleTo( Element target, bool visible );
return Native.Element.SetPosition( this.userdata, position, warp );
}
public bool SetRotation( Vector3 rotation, string order = "default", bool pedRotation = false ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetInterior( int interior, Vector3 position = null );
return Native.Element.SetRotation( this.userdata, rotation, order, pedRotation );
}
public bool SetVelocity( Vector3 velocity ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetDimension( int dimension );
return Native.Element.SetVelocity( this.userdata, velocity );
}
public bool SetVisibleTo( Element target, bool visible ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool Attach( Element target, Vector3 offsetPosition = null, Vector3 offsetRotation = null );
return Native.Element.SetVisibleTo( this.userdata, target.GetUserData(), visible );
}
public bool SetInterior( int interior, Vector3 position = null ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool Detach( Element target );
return Native.Element.SetInterior( this.userdata, interior, position );
}
public bool SetDimension( int dimension ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetAlpha( int alpha );
return Native.Element.SetDimension( this.userdata, dimension );
}
public bool Attach( Element target, Vector3 offsetPosition = null, Vector3 offsetRotation = null ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetDoubleSided( bool doublesided );
return Native.Element.Attach( this.userdata, target.GetUserData(), offsetPosition, offsetRotation );
}
public bool Detach( Element target ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetHealth( float health );
return Native.Element.Detach( this.userdata, target.GetUserData() );
}
public bool SetAlpha( int alpha ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetModel( int model );
return Native.Element.SetAlpha( this.userdata, alpha );
}
public bool SetDoubleSided( bool doublesided ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetAttachedOffsets( Vector3 offsetPosition = null, Vector3 offsetRotation = null );
return Native.Element.SetDoubleSided( this.userdata, doublesided );
}
public bool SetHealth( float health ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetSyncer( Player player );
return Native.Element.SetHealth( this.userdata, health );
}
public bool SetModel( int model ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetCollisionsEnabled( bool enabled );
return Native.Element.SetModel( this.userdata, model );
}
public bool SetAttachedOffsets( Vector3 offsetPosition = null, Vector3 offsetRotation = null ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetFrozen( bool frozen );
return Native.Element.SetAttachedOffsets( this.userdata, offsetPosition, offsetRotation );
}
public bool SetSyncer( Player player ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetLowLODElement( Element element );
return Native.Element.SetSyncer( this.userdata, player.GetUserData() );
}
public bool SetCollisionsEnabled( bool enabled )
{
return Native.Element.SetCollisionsEnabled( this.userdata, enabled );
}
public bool SetFrozen( bool frozen )
{
return Native.Element.SetFrozen( this.userdata, frozen );
}
public bool SetLowLODElement( Element element )
{
return Native.Element.SetLowLODElement( this.userdata, element.GetUserData() );
}
#endregion #endregion
#region Get #region Get
public string GetID() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern uint GetUserData();
return Native.Element.GetID( this.userdata );
}
public string GetData( string key, bool inherit = true ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern string GetID();
return Native.Element.GetData( this.userdata, key, inherit );
}
public string GetElementType() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern object GetData( string key, bool inherit = true );
return Native.Element.GetType( this.userdata );
}
public Object GetChild( UInt32 parent, int index ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern string GetElementType();
return Element.FindOrCreate( Native.Element.GetChild( this.userdata, index ) );
}
public int GetChildrenCount() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern object GetChild( int index );
return Native.Element.GetChildrenCount( this.userdata );
}
public Object GetParent() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetChildrenCount();
return Element.FindOrCreate( Native.Element.GetParent( this.userdata ) );
}
public Vector3 GetPosition() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern object GetParent();
return Native.Element.GetPosition( this.userdata );
}
public Vector3 GetRotation( string order = "default" ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Vector3 GetPosition();
return Native.Element.GetRotation( this.userdata, order );
}
public Vector3 GetVelocity() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Vector3 GetRotation( string order = "default" );
return Native.Element.GetVelocity( this.userdata );
}
public int GetInterior() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Vector3 GetVelocity();
return Native.Element.GetInterior( this.userdata );
}
public int GetDimension() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetInterior();
return Native.Element.GetDimension( this.userdata );
}
public string GetZoneName() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetDimension();
return Native.Element.GetZoneName( this.userdata );
}
public Object GetAttachedTo() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern string GetZoneName();
return Element.FindOrCreate( Native.Element.GetAttachedTo( this.userdata ) );
}
public Object GetColShape() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Element GetAttachedTo();
return Element.FindOrCreate( Native.Element.GetColShape( this.userdata ) );
}
public int GetAlpha() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Element GetColShape();
return Native.Element.GetAlpha( this.userdata );
}
public float GetHealth() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetAlpha();
return Native.Element.GetHealth( this.userdata );
}
public int GetModel() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern float GetHealth();
return Native.Element.GetModel( this.userdata );
}
public Player GetSyncer() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetModel();
return Element.FindOrCreate( Native.Element.GetSyncer( this.userdata ) ) as Player;
}
public bool GetCollisionsEnabled() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Player GetSyncer();
return Native.Element.GetCollisionsEnabled( this.userdata );
}
public Object GetLowLODElement() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool GetCollisionsEnabled();
return Element.FindOrCreate( Native.Element.GetLowLODElement( this.userdata ) );
} [MethodImpl( MethodImplOptions.InternalCall )]
public extern Element GetLowLODElement();
#endregion #endregion
#region Is #region Is
public bool IsValid() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsValid();
return Native.Element.IsElement( this.userdata );
}
public bool IsWithinColShape( ColShape colshape ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsWithinColShape( ColShape colshape );
return Native.Element.IsWithinColShape( this.userdata, colshape.GetUserData() );
}
public bool IsWithinMarker( Marker marker ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsWithinMarker( Marker marker );
return Native.Element.IsWithinMarker( this.userdata, marker.GetUserData() );
}
public bool IsAttached() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsAttached();
return Native.Element.IsAttached( this.userdata );
}
public bool IsDoubleSided() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsDoubleSided();
return Native.Element.IsDoubleSided( this.userdata );
}
public bool IsInWater() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsInWater();
return Native.Element.IsInWater( this.userdata );
}
public bool IsFrozen() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsFrozen();
return Native.Element.IsFrozen( this.userdata );
}
public bool IsElementLowLOD() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsElementLowLOD();
return Native.Element.IsElementLowLOD( this.userdata );
}
#endregion #endregion
@ -337,37 +214,30 @@ namespace MultiTheftAuto
return (int)this.GetHashCode(); return (int)this.GetHashCode();
} }
public uint GetUserData()
{
return this.userdata;
}
public override string ToString() public override string ToString()
{ {
return string.Format( "[{0}: 0x{1}]", this.GetType().Name, this.userdata.ToString( "X8" ) ); return string.Format( "[{0}: 0x{1}]", this.GetType().Name, this.GetUserData().ToString( "X8" ) );
} }
#endregion #endregion
#region Static methods #region Static methods
[MethodImpl( MethodImplOptions.InternalCall )]
public static extern Element GetRootElement();
[MethodImpl( MethodImplOptions.InternalCall )]
public static extern Element[] GetByType( string elementType );
[MethodImpl( MethodImplOptions.InternalCall )]
public static extern Element GetByID( string elementID, int index = 0 );
[MethodImpl( MethodImplOptions.InternalCall )]
public static extern Element GetByIndex( string type, int index );
public static IEnumerable<T> GetByType<T>( string elementType ) where T : class public static IEnumerable<T> GetByType<T>( string elementType ) where T : class
{ {
return Native.Element.GetByType( elementType ).Select( i => Element.FindOrCreate( i ) as T ); return GetByType( elementType ).Select( i => i as T );
}
public static Object GetByID( string elementID, int index = 0 )
{
UInt32 userdata = Native.Element.GetByID( elementID, index );
return userdata != 0 ? Element.FindOrCreate( userdata ) : null;
}
public static Object GetByIndex( string type, int index )
{
UInt32 userdata = Native.Element.GetByIndex( type, index );
return userdata != 0 ? Element.FindOrCreate( userdata ) : null;
} }
#endregion #endregion

View File

@ -9,8 +9,7 @@ namespace MultiTheftAuto
{ {
#region Constructors #region Constructors
public Marker( UInt32 userdata ) public Marker()
: base( userdata )
{ {
} }

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Runtime.CompilerServices;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -25,16 +26,11 @@ namespace MultiTheftAuto
#region Constructors #region Constructors
public Ped( UInt32 userdata ) [MethodImpl( MethodImplOptions.InternalCall )]
: base( userdata ) public extern Ped( int modelid, Vector3 position, float rot = 0.0f, bool synced = true );
internal Ped()
{ {
}
public Ped( int modelid, Vector3 position, float rot = 0.0f, bool synced = true )
: base( Native.Ped.Create( modelid, position, rot, synced ) )
{
} }
#endregion #endregion
@ -43,213 +39,133 @@ namespace MultiTheftAuto
#region Set #region Set
public bool SetArmor( int armor ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetArmor( int armor );
return Native.Ped.SetArmor( this.GetUserData(), armor );
}
public bool Kill( Ped killer = null, int weapon = 255, int bodyPart = 255, bool stealth = false ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool Kill( Ped killer = null, int weapon = 255, int bodyPart = 255, bool stealth = false );
return Native.Ped.Kill( this.GetUserData(), killer != null ? killer.GetUserData() : 0, weapon, bodyPart, stealth );
}
public bool SetStat( int stat, float value ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetStat( int stat, float value );
return Native.Ped.SetStat( this.GetUserData(), stat, value );
}
public bool AddClothes( string clothesTexture, string clothesModel, int clothesType ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool AddClothes( string clothesTexture, string clothesModel, int clothesType );
return Native.Ped.AddClothes( this.GetUserData(), clothesTexture, clothesModel, clothesType );
}
public bool RemoveClothes( int clothesType, string clothesTexture, string clothesModel ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool RemoveClothes( int clothesType, string clothesTexture, string clothesModel );
return Native.Ped.RemoveClothes( this.GetUserData(), clothesType, clothesTexture, clothesModel );
}
public bool GiveJetPack() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool GiveJetPack();
return Native.Ped.GiveJetPack( this.GetUserData() );
}
public bool RemoveJetPack() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool RemoveJetPack();
return Native.Ped.RemoveJetPack( this.GetUserData() );
}
public bool SetFightingStyle( int style ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetFightingStyle( int style );
return Native.Ped.SetFightingStyle( this.GetUserData(), style );
}
public bool SetPedMoveAnim( int style ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetPedMoveAnim( int style );
return Native.Ped.SetPedMoveAnim( this.GetUserData(), style );
}
public bool SetGravity( float gravity ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetGravity( float gravity );
return Native.Ped.SetGravity( this.GetUserData(), gravity );
}
public bool SetChoking( bool choking ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetChoking( bool choking );
return Native.Ped.SetChoking( this.GetUserData(), choking );
}
public bool WarpIntoVehicle( Vehicle vehicle, int seat = 0 ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool WarpIntoVehicle( Vehicle vehicle, int seat = 0 );
return Native.Ped.WarpIntoVehicle( this.GetUserData(), vehicle.GetUserData(), seat );
}
public bool RemoveFromVehicle() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool RemoveFromVehicle();
return Native.Ped.RemoveFromVehicle( this.GetUserData() );
}
public bool SetDoingGangDriveby( bool state ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetDoingGangDriveby( bool state );
return Native.Ped.SetDoingGangDriveby( this.GetUserData(), state );
}
public bool SetAnimation( string block = null, string anim = null, int time = -1, bool loop = true, bool updatePosition = true, bool interruptable = true, bool freezeLastFrame = true ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetAnimation( string block = null, string anim = null, int time = -1, bool loop = true, bool updatePosition = true, bool interruptable = true, bool freezeLastFrame = true );
return Native.Ped.SetAnimation( this.GetUserData(), block, anim, time, loop, updatePosition, interruptable, freezeLastFrame );
}
public bool SetAnimationProgress( string anim, float progress ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetAnimationProgress( string anim, float progress );
return Native.Ped.SetAnimationProgress( this.GetUserData(), anim, progress );
}
public bool SetWeaponSlot( int weaponSlot ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetWeaponSlot( int weaponSlot );
return Native.Ped.SetWeaponSlot( this.GetUserData(), weaponSlot );
}
public bool SetOnFire( bool isOnFire ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetOnFire( bool isOnFire );
return Native.Ped.SetOnFire( this.GetUserData(), isOnFire );
}
public bool SetHeadless( bool headless ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetHeadless( bool headless );
return Native.Ped.SetHeadless( this.GetUserData(), headless );
}
public bool ReloadWeapon() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool ReloadWeapon();
return Native.Ped.ReloadWeapon( this.GetUserData() );
}
#endregion #endregion
#region Get #region Get
public float GetArmor() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern float GetArmor();
return Native.Ped.GetArmor( this.GetUserData() );
}
public float GetStat( int stat ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern float GetStat( int stat );
return Native.Ped.GetStat( this.GetUserData(), stat );
}
public Object GetTarget() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Element GetTarget();
return Element.FindOrCreate( Native.Ped.GetTarget( this.GetUserData() ) );
}
public int GetWeapon( int slot = 0 ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetWeapon( int slot = 0 );
return Native.Ped.GetWeapon( this.GetUserData(), slot );
}
public int GetFightingStyle() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetFightingStyle();
return Native.Ped.GetFightingStyle( this.GetUserData() );
}
public int GetPedMoveAnim() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetPedMoveAnim();
return Native.Ped.GetPedMoveAnim( this.GetUserData() );
}
public float GetGravity() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern float GetGravity();
return Native.Ped.GetGravity( this.GetUserData() );
}
public Object GetContactElement() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Element GetContactElement();
return Element.FindOrCreate( Native.Ped.GetContactElement( this.GetUserData() ) );
}
public int GetWeaponSlot() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetWeaponSlot();
return Native.Ped.GetWeaponSlot( this.GetUserData() );
}
public Vehicle GetVehicle() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Vehicle GetVehicle();
return Element.FindOrCreate( Native.Ped.GetOccupiedVehicle( this.GetUserData() ) ) as Vehicle;
}
public int GetVehicleSeat() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetVehicleSeat();
return Native.Ped.GetOccupiedVehicleSeat( this.GetUserData() );
}
#endregion #endregion
#region Is #region Is
public bool IsChoking() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsChoking();
return Native.Ped.IsChoking( this.GetUserData() );
}
public bool IsDead() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsDead();
return Native.Ped.IsDead( this.GetUserData() );
}
public bool IsDucked() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsDucked();
return Native.Ped.IsDucked( this.GetUserData() );
}
public bool IsHaveJetPack() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsHaveJetPack();
return Native.Ped.DoesHaveJetPack( this.GetUserData() );
}
public bool IsOnGround() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsOnGround();
return Native.Ped.IsOnGround( this.GetUserData() );
}
public bool IsDoingGangDriveby() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsDoingGangDriveby();
return Native.Ped.IsDoingGangDriveby( this.GetUserData() );
}
public bool IsOnFire() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsOnFire();
return Native.Ped.IsOnFire( this.GetUserData() );
}
public bool IsHeadless() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsHeadless();
return Native.Ped.IsHeadless( this.GetUserData() );
}
public bool IsInVehicle() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsInVehicle();
return Native.Ped.IsInVehicle( this.GetUserData() );
}
#endregion #endregion

View File

@ -8,8 +8,7 @@ namespace MultiTheftAuto
{ {
public class Pickup : Element public class Pickup : Element
{ {
public Pickup( UInt32 userdata ) public Pickup()
: base( userdata )
{ {
} }
} }

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Runtime.CompilerServices;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -7,262 +8,158 @@ namespace MultiTheftAuto
{ {
public class Player : Ped public class Player : Ped
{ {
#region Constructors
public Player( UInt32 userdata )
: base( userdata )
{
}
#endregion
#region Methods #region Methods
#region Set #region Set
public bool SetMoney( int money ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetMoney( int money );
return Native.Player.SetMoney( this.GetUserData(), money );
}
public bool GiveMoney( int money ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool GiveMoney( int money );
return Native.Player.GiveMoney( this.GetUserData(), money );
}
public bool TakeMoney( int money ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool TakeMoney( int money );
return Native.Player.TakeMoney( this.GetUserData(), money );
}
public bool Spawn( Vector3 position, int rotation = 0, int skinID = 0, int interior = 0, int dimension = 0, Team team = null ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool Spawn( Vector3 position, int rotation = 0, int skinID = 0, int interior = 0, int dimension = 0, Team team = null );
return Native.Player.Spawn( this.GetUserData(), position, rotation, skinID, interior, dimension, team != null ? team.GetUserData() : 0 );
}
public bool ShowHudComponent( string component, bool show ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool ShowHudComponent( string component, bool show );
return Native.Player.ShowHudComponent( this.GetUserData(), component, show );
}
public bool SetWantedLevel( int level ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetWantedLevel( int level );
return Native.Player.SetWantedLevel( this.GetUserData(), level );
}
public bool ForceMap( bool forcedOn ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool ForceMap( bool forcedOn );
return Native.Player.ForceMap( this.GetUserData(), forcedOn );
}
public bool SetNametagText( string text ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetNametagText( string text );
return Native.Player.SetNametagText( this.GetUserData(), text );
}
public bool SetNametagColor( Color color ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetNametagColor( Color color );
return Native.Player.SetNametagColor( this.GetUserData(), color );
}
public bool SetNametagShowing( bool showed ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetNametagShowing( bool showed );
return Native.Player.SetNametagShowing( this.GetUserData(), showed );
}
public bool SetMuted( bool muted ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetMuted( bool muted );
return Native.Player.SetMuted( this.GetUserData(), muted );
}
public bool SetBlurLevel( int level ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetBlurLevel( int level );
return Native.Player.SetBlurLevel( this.GetUserData(), level );
}
public bool Redirect( string serverIP, int serverPort, string serverPassword = null ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool Redirect( string serverIP, int serverPort, string serverPassword = null );
return Native.Player.Redirect( this.GetUserData(), serverIP, serverPort, serverPassword );
}
public bool SetName( string name ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetName( string name );
return Native.Player.SetName( this.GetUserData(), name );
}
public bool DetonateSatchels() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool DetonateSatchels();
return Native.Player.DetonateSatchels( this.GetUserData() );
}
public bool TakeScreenShot( int width, int height, string tag = "", int quality = 30, int maxBandwith = 5000 ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool TakeScreenShot( int width, int height, string tag = "", int quality = 30, int maxBandwith = 5000 );
return Native.Player.TakeScreenShot( this.GetUserData(), width, height, tag, quality, maxBandwith );
}
public bool SetTeam( Team team ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetTeam( Team team );
return Native.Player.SetTeam( this.GetUserData(), team.GetUserData() );
}
public bool SetCameraMatrix( CameraMatrix pCameraMatrix ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetCameraMatrix( CameraMatrix pCameraMatrix );
return Native.Player.SetCameraMatrix( this.userdata, pCameraMatrix );
}
public bool SetCameraTarget( Element pTarget ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetCameraTarget( Element pTarget );
return Native.Player.SetCameraTarget( this.userdata, pTarget.userdata );
}
public bool SetCameraInterior( UInt16 ucInterior ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetCameraInterior( UInt16 ucInterior );
return Native.Player.SetCameraInterior( this.userdata, ucInterior );
}
public bool FadeCamera( bool bFadeIn, float fFadeTime, Color pColor ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool FadeCamera( bool bFadeIn, float fFadeTime, Color pColor );
return Native.Player.FadeCamera( this.userdata, bFadeIn, fFadeTime, pColor );
}
#endregion #endregion
#region Get #region Get
public int GetAmmoInClip( int weaponSlot = 0 ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetAmmoInClip( int weaponSlot = 0 );
return Native.Player.GetAmmoInClip( this.GetUserData(), weaponSlot );
}
public int GetTotalAmmo( int weaponSlot = 0 ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetTotalAmmo( int weaponSlot = 0 );
return Native.Player.GetTotalAmmo( this.GetUserData(), weaponSlot );
}
public bool SetWeaponAmmo( int weapon, int totalAmmo, int ammoInClip ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetWeaponAmmo( int weapon, int totalAmmo, int ammoInClip );
return Native.Player.SetWeaponAmmo( this.GetUserData(), weapon, totalAmmo, ammoInClip );
}
public Player GetFromName( string name ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Player GetFromName( string name );
return Element.FindOrCreate( Native.Player.GetFromName( name ) ) as Player;
}
public int GetMoney() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetMoney();
return Native.Player.GetMoney( this.GetUserData() );
}
public int GetPing() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetPing();
return Native.Player.GetPing( this.GetUserData() );
}
public Player GetRandom() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Player GetRandom();
return Element.FindOrCreate( Native.Player.GetRandom() ) as Player;
}
public Team GetTeam() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Team GetTeam();
return Element.FindOrCreate( Native.Player.GetTeam( this.GetUserData() ) ) as Team;
}
public int GetWantedLevel() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetWantedLevel();
return Native.Player.GetWantedLevel( this.GetUserData() );
}
public int GetIdleTime() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetIdleTime();
return Native.Player.GetIdleTime( this.GetUserData() );
}
public string GetNametagText() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern string GetNametagText();
return Native.Player.GetNametagText( this.GetUserData() );
}
public Color GetNametagColor() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Color GetNametagColor();
return Native.Player.GetNametagColor( this.GetUserData() );
}
public string GetSerial() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern string GetSerial();
return Native.Player.GetSerial( this.GetUserData() );
}
public string GetUserName() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern string GetUserName();
return Native.Player.GetUserName( this.GetUserData() );
}
public int GetBlurLevel() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetBlurLevel();
return Native.Player.GetBlurLevel( this.GetUserData() );
}
public string GetName() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern string GetName();
return Native.Player.GetName( this.GetUserData() );
}
public string GetIP() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern string GetIP();
return Native.Player.GetIP( this.GetUserData() );
}
public Account GetAccount() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Account GetAccount();
return Element.FindOrCreate( Native.Player.GetAccount( this.GetUserData() ) ) as Account;
}
public string GetVersion() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern string GetVersion();
return Native.Player.GetVersion( this.GetUserData() );
}
public Object GetACInfo() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern PlayerACInfo GetACInfo();
return Native.Player.GetACInfo( this.GetUserData() );
}
public CameraMatrix GetCameraMatrix() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern CameraMatrix GetCameraMatrix();
return Native.Player.GetCameraMatrix( this.userdata );
}
public UInt32 GetCameraTarget() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Element GetCameraTarget();
return Native.Player.GetCameraTarget( this.userdata );
}
public UInt16 GetCameraInterior() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern UInt16 GetCameraInterior();
return Native.Player.GetCameraInterior( this.userdata );
}
#endregion #endregion
#region Is #region Is
public bool IsMuted() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsMuted();
return Native.Player.IsMuted( this.GetUserData() );
}
public bool IsMapForced() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsMapForced();
return Native.Player.IsMapForced( this.GetUserData() );
}
public bool IsNametagShowing() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsNametagShowing();
return Native.Player.IsNametagShowing( this.GetUserData() );
}
#endregion #endregion
@ -270,20 +167,14 @@ namespace MultiTheftAuto
#region Static #region Static
public static Array GetAlivePlayers() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern static Player[] GetAlivePlayers();
return Native.Player.GetAlivePlayers();
}
public static Array GetDeadPlayers() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern static Player[] GetDeadPlayers();
return Native.Player.GetDeadPlayers();
}
public static int GetCount() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern static int GetCount();
return Native.Player.GetCount();
}
#endregion #endregion
} }

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Runtime.CompilerServices;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -8,25 +9,15 @@ using MultiTheftAuto.Utils;
namespace MultiTheftAuto namespace MultiTheftAuto
{ {
public class Resource : IdentifiedPool<Resource>, IIdentifyable public class Resource
{ {
#region Properties
public UInt32 userdata
{
get;
private set;
}
#endregion
#region Static properties #region Static properties
public static Element Root public static Element Root
{ {
get get
{ {
return Element.FindOrCreate( Native.Resource.GetRootElement() ); return Resource.GetCurrent().GetRoot();
} }
} }
@ -34,174 +25,98 @@ namespace MultiTheftAuto
#region Constuctors #region Constuctors
public Resource( string resourceName, string organizationalDir ) [MethodImpl( MethodImplOptions.InternalCall )]
: this( Native.Resource.Create( resourceName, organizationalDir ) ) public extern Resource( string resourceName, string organizationalDir );
{
}
public Resource( UInt32 userdata ) private Resource()
{ {
this.userdata = userdata;
} }
#endregion #endregion
#region Methods #region Methods
public Resource Copy( string newResourceName, string organizationalDir ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Resource Copy( string newResourceName, string organizationalDir );
return new Resource( Native.Resource.Copy( this.userdata, newResourceName, organizationalDir ) );
}
public Element GetRoot() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Element GetRoot();
return Element.FindOrCreate( Native.Resource.GetRootElement( this.userdata ) );
}
public Element GetMapRootElement( UInt32 resource, string map ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Element GetMapRootElement( UInt32 resource, string map );
return Element.FindOrCreate( Native.Resource.GetMapRootElement( this.userdata, map ) );
}
public Element GetDynamicElementRoot() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Element GetDynamicElementRoot();
return Element.FindOrCreate( Native.Resource.GetDynamicElementRoot( this.userdata ) );
}
public bool RemoveFile( string filename ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool RemoveFile( string filename );
return Native.Resource.RemoveFile( this.userdata, filename );
}
public string GetInfo( string attribute ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern string GetInfo( string attribute );
return Native.Resource.GetInfo( this.userdata, attribute );
}
public uint GetLastStartTime() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern uint GetLastStartTime();
return Native.Resource.GetLastStartTime( this.userdata );
}
public string GetLoadFailureReason() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern string GetLoadFailureReason();
return Native.Resource.GetLoadFailureReason( this.userdata );
}
public uint GetLoadTime() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern uint GetLoadTime();
return Native.Resource.GetLoadTime( this.userdata );
}
public string GetName() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern string GetName();
return Native.Resource.GetName( this.userdata );
}
public string GetState() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern string GetState();
return Native.Resource.GetState( this.userdata );
}
public bool SetDefaultSetting( string settingName, string settingValue ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetDefaultSetting( string settingName, string settingValue );
return Native.Resource.SetDefaultSetting( this.userdata, settingName, settingValue );
}
public bool RemoveDefaultSetting( string settingName ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool RemoveDefaultSetting( string settingName );
return Native.Resource.RemoveDefaultSetting( this.userdata, settingName );
}
public bool Start( bool persistent = false, bool startIncludedResources = true, bool loadServerConfigs = true, bool loadMaps = true, bool loadServerScripts = true, bool loadHTML = true, bool loadClientConfigs = true, bool loadClientScripts = true, bool loadFiles = true ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool Start( bool persistent = false, bool startIncludedResources = true, bool loadServerConfigs = true, bool loadMaps = true, bool loadServerScripts = true, bool loadHTML = true, bool loadClientConfigs = true, bool loadClientScripts = true, bool loadFiles = true );
return Native.Resource.Start( this.userdata, persistent, startIncludedResources, loadServerConfigs, loadMaps, loadServerScripts, loadHTML, loadClientConfigs, loadClientScripts, loadFiles );
}
public bool Restart() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool Restart();
return Native.Resource.Restart( this.userdata );
}
public bool Stop() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool Stop();
return Native.Resource.Stop( this.userdata );
}
public bool SetInfo( string attribute, string value ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetInfo( string attribute, string value );
return Native.Resource.SetInfo( this.userdata, attribute, value );
}
public bool Rename( string newResourceName, string organizationalPath ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool Rename( string newResourceName, string organizationalPath );
return Native.Resource.Rename( this.GetName(), newResourceName, organizationalPath );
}
public bool Delete() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool Delete();
return Native.Resource.Delete( this.GetName() );
}
public bool UpdateACLRequest( string rightName, bool bAccess, string byWho ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool UpdateACLRequest( string rightName, bool bAccess, string byWho );
return Native.Resource.UpdateACLRequest( this.userdata, rightName, bAccess, byWho );
}
#endregion #endregion
#region Static methods #region Static methods
public static bool Rename( string resourceName, string newResourceName, string organizationalPath ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern static bool Rename( string resourceName, string newResourceName, string organizationalPath );
return Native.Resource.Rename( resourceName, newResourceName, organizationalPath );
}
public static bool Delete( string resourceName ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern static bool Delete( string resourceName );
return Native.Resource.Delete( resourceName );
}
public static bool Refresh( bool refreshAll = false ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern static bool Refresh( bool refreshAll = false );
return Native.Resource.Refresh( refreshAll );
}
public static Resource GetCurrent() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern static Resource GetCurrent();
return Resource.FindOrCreate( Native.Resource.GetCurrent() );
}
public static Resource[] GetAll() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern static Resource[] GetAll();
UInt32[] userdataArray = Native.Resource.GetResources();
Resource[] resources = new Resource[ userdataArray.Length ]; [MethodImpl( MethodImplOptions.InternalCall )]
public extern static Resource GetFromName( string resourceName );
for( uint i = 0; i < userdataArray.Length; i++ )
{
resources.SetValue( Resource.FindOrCreate( userdataArray[ i ] ), i );
}
return resources;
}
public static Element GetRootElement( Element resource = null )
{
return Element.FindOrCreate( Native.Resource.GetRootElement( resource.userdata ) );
}
public static Resource GetFromName( string resourceName )
{
UInt32 userdata = Native.Resource.GetFromName( resourceName );
if( userdata != 0 )
{
return Resource.FindOrCreate( userdata );
}
return null;
}
#endregion #endregion
} }

View File

@ -7,24 +7,16 @@ namespace MultiTheftAuto
public static class Server public static class Server
{ {
public static bool OutputChatBox( string text, Element element, Color color, bool colorCoded ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern static bool OutputChatBox( string text, Element element, Color color, bool colorCoded );
return Native.Server.OutputChatBox( text, element.userdata, color, colorCoded );
}
public static bool AddCommandHandler( string name, CommandHandler handler, bool restricted = false, bool caseSensitive = true ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern static bool AddCommandHandler( string name, CommandHandler handler, bool restricted = false, bool caseSensitive = true );
return Native.Server.AddCommandHandler( name, handler, restricted, caseSensitive );
}
public static bool ExecuteCommandHandler( string name, Player player, string args ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern static bool ExecuteCommandHandler( string name, Player player, string args );
return Native.Server.ExecuteCommandHandler( name, player.userdata, args );
}
public static bool RemoveCommandHandler( string name, CommandHandler handler ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern static bool RemoveCommandHandler( string name, CommandHandler handler = null );
return Native.Server.RemoveCommandHandler( name, handler );
}
} }
} }

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Runtime.CompilerServices;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -9,79 +10,47 @@ namespace MultiTheftAuto
{ {
#region Construcotrs #region Construcotrs
public Team( string name, Color color = null ) [MethodImpl( MethodImplOptions.InternalCall )]
: base( Native.Team.Create( name, color ) ) public extern Team( string name, Color color = null );
private Team()
{ {
}
public Team( UInt32 userdata )
: base( userdata )
{
} }
#endregion #endregion
#region Methods #region Methods
public string GetName() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern string GetName();
return Native.Team.GetName( this.userdata );
}
public Color GetColor() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Color GetColor();
return Native.Team.GetColor( this.userdata );
}
public bool GetFriendlyFire() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool GetFriendlyFire();
return Native.Team.GetFriendlyFire( this.userdata );
}
public Player[] GetPlayers() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Player[] GetPlayers();
UInt32[] userdataArray = Native.Team.GetPlayers( this.userdata );
Player[] players = new Player[ userdataArray.Length ]; [MethodImpl( MethodImplOptions.InternalCall )]
public extern int CountPlayers();
for( uint i = 0; i < userdataArray.Length; i++ ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetName( string name );
players.SetValue( Element.FindOrCreate( userdataArray[ i ] ) as Player, i );
}
return players; [MethodImpl( MethodImplOptions.InternalCall )]
} public extern bool SetColor( Color color );
public int CountPlayers() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetFriendlyFire( bool enabled );
return Native.Team.CountPlayers( this.userdata );
}
public bool SetName( string name )
{
return Native.Team.SetName( this.userdata, name );
}
public bool SetColor( Color color )
{
return Native.Team.SetColor( this.userdata, color );
}
public bool SetFriendlyFire( bool enabled )
{
return Native.Team.SetFriendlyFire( this.userdata, enabled );
}
#endregion #endregion
#region Static methods #region Static methods
public static Team GetFromName( string name ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern static Team GetFromName( string name );
return Element.FindOrCreate( Native.Team.GetFromName( name ) ) as Team;
}
#endregion #endregion
} }

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Runtime.CompilerServices;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -230,7 +231,7 @@ namespace MultiTheftAuto
{ {
get get
{ {
return Native.Vehicle.GetType( this.GetUserData() ); return this.GetVehicleType();
} }
} }
@ -238,36 +239,34 @@ namespace MultiTheftAuto
#region Constructors #region Constructors
public Vehicle( VehicleModel model, Vector3 position, Vector3 rotation, string numberplate = null, bool direction = false, int variant1 = 255, int variant2 = 255 ) [MethodImpl( MethodImplOptions.InternalCall )]
: base( Native.Vehicle.Create( (int)model, position, rotation, numberplate, direction, variant1, variant2 ) ) public extern Vehicle( VehicleModel model, Vector3 position, Vector3 rotation, string numberplate = null, bool direction = false, int variant1 = 255, int variant2 = 255 );
internal Vehicle()
{ {
} }
public Vehicle( UInt32 userdata ) ~Vehicle()
: base( userdata )
{ {
Debug.Info( "~Vehicle() [" + this.GetName() + "]" );
} }
#endregion #endregion
#region Static Methods #region Static Methods
public static string GetNameFromModel( int modelID ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern static string GetNameFromModel( int modelID );
return Native.Vehicle.GetNameFromModel( modelID );
}
public static string GetUpgradeSlotName( int upgradeOrSlot ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern static string GetUpgradeSlotName( int upgradeOrSlot );
return Native.Vehicle.GetUpgradeSlotName( upgradeOrSlot );
}
public static IEnumerable<Vehicle> GetOfType( VehicleModel model ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern static Vehicle[] GetOfType( VehicleModel model );
return Native.Vehicle.GetOfType( (int)model ).Select( i => Element.FindOrCreate( i ) as Vehicle );
} [MethodImpl( MethodImplOptions.InternalCall )]
public extern static int GetModelFromName( string name );
#endregion #endregion
@ -275,429 +274,256 @@ namespace MultiTheftAuto
#region Set #region Set
public bool Fix() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool Fix();
return Native.Vehicle.Fix( this.GetUserData() );
}
public bool Blow( bool blow = true ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool Blow( bool blow = true );
return Native.Vehicle.Blow( this.GetUserData(), blow );
}
public bool SetTurnVelocity( Vector3 velocity ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetTurnVelocity( Vector3 velocity );
return Native.Vehicle.SetTurnVelocity( this.GetUserData(), velocity );
}
public bool SetColor( Color color1, Color color2 = null, Color color3 = null, Color color4 = null ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetColor( Color color1, Color color2 = null, Color color3 = null, Color color4 = null );
return Native.Vehicle.SetColor( this.GetUserData(), color1, color2, color3, color4 );
}
public bool SetLandingGearDown( bool state ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetLandingGearDown( bool state );
return Native.Vehicle.SetLandingGearDown( this.GetUserData(), state );
}
public bool SetLocked( bool locked ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetLocked( bool locked );
return Native.Vehicle.SetLocked( this.GetUserData(), locked );
}
public bool SetDoorsUndamageable( bool state ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetDoorsUndamageable( bool state );
return Native.Vehicle.SetDoorsUndamageable( this.GetUserData(), state );
}
public bool SetSirensOn( bool state ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetSirensOn( bool state );
return Native.Vehicle.SetSirensOn( this.GetUserData(), state );
}
public bool SetTaxiLightOn( bool state ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetTaxiLightOn( bool state );
return Native.Vehicle.SetTaxiLightOn( this.GetUserData(), state );
}
public bool AddUpgrade( int upgrade ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool AddUpgrade( int upgrade );
return Native.Vehicle.AddUpgrade( this.GetUserData(), upgrade );
}
public bool RemoveUpgrade( int upgrade ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool RemoveUpgrade( int upgrade );
return Native.Vehicle.RemoveUpgrade( this.GetUserData(), upgrade );
}
public bool SetDoorState( int door, int state ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetDoorState( int door, int state );
return Native.Vehicle.SetDoorState( this.GetUserData(), door, state );
}
public bool SetWheelStates( int frontLeft, int rearLeft, int frontRight, int rearRight ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetWheelStates( int frontLeft, int rearLeft, int frontRight, int rearRight );
return Native.Vehicle.SetWheelStates( this.GetUserData(), frontLeft, rearLeft, frontRight, rearRight );
}
public bool SetLightState( int light, int state ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetLightState( int light, int state );
return Native.Vehicle.SetLightState( this.GetUserData(), light, state );
}
public bool SetPanelState( int panelID, int state ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetPanelState( int panelID, int state );
return Native.Vehicle.SetPanelState( this.GetUserData(), panelID, state );
}
public bool SetIdleRespawnDelay( int timeDelay ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetIdleRespawnDelay( int timeDelay );
return Native.Vehicle.SetIdleRespawnDelay( this.GetUserData(), timeDelay );
}
public bool SetRespawnDelay( int timeDelay ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetRespawnDelay( int timeDelay );
return Native.Vehicle.SetRespawnDelay( this.GetUserData(), timeDelay );
}
public bool SetRespawnPosition( Vector3 position, Vector3 rotation ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetRespawnPosition( Vector3 position, Vector3 rotation );
return Native.Vehicle.SetRespawnPosition( this.GetUserData(), position, rotation );
}
public bool ToggleRespawn( bool respawn ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool ToggleRespawn( bool respawn );
return Native.Vehicle.ToggleRespawn( this.GetUserData(), respawn );
}
public bool ResetExplosionTime() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool ResetExplosionTime();
return Native.Vehicle.ResetExplosionTime( this.GetUserData() );
}
public bool ResetIdleTime() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool ResetIdleTime();
return Native.Vehicle.ResetIdleTime( this.GetUserData() );
}
public bool Spawn( Vector3 position, Vector3 rotation ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool Spawn( Vector3 position, Vector3 rotation );
return Native.Vehicle.Spawn( this.GetUserData(), position, rotation );
}
public bool Respawn() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool Respawn();
return Native.Vehicle.Respawn( this.GetUserData() );
}
public bool SetOverrideLights( int state ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetOverrideLights( int state );
return Native.Vehicle.SetOverrideLights( this.GetUserData(), state );
}
public bool AttachTrailerToVehicle( Element trailer ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool AttachTrailerToVehicle( Element trailer );
return Native.Vehicle.AttachTrailerToVehicle( this.GetUserData(), trailer.GetUserData() );
}
public bool DetachTrailerFromVehicle( Element trailer = null ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool DetachTrailerFromVehicle( Element trailer = null );
if( trailer == null )
return Native.Vehicle.DetachTrailerFromVehicle( this.GetUserData() );
return Native.Vehicle.DetachTrailerFromVehicle( this.GetUserData(), trailer.GetUserData() ); [MethodImpl( MethodImplOptions.InternalCall )]
} public extern bool SetEngineState( bool state );
public bool SetEngineState( bool state ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetDamageProof( bool state );
return Native.Vehicle.SetEngineState( this.GetUserData(), state );
}
public bool SetDamageProof( bool state ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetPaintjob( int value );
return Native.Vehicle.SetDamageProof( this.GetUserData(), state );
}
public bool SetPaintjob( int value ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetFuelTankExplodable( bool state );
return Native.Vehicle.SetPaintjob( this.GetUserData(), value );
}
public bool SetFuelTankExplodable( bool state ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetTrainDerailed( bool state );
return Native.Vehicle.SetFuelTankExplodable( this.GetUserData(), state );
}
public bool SetTrainDerailed( bool state ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetTrainDerailable( bool state );
return Native.Vehicle.SetTrainDerailed( this.GetUserData(), state );
}
public bool SetTrainDerailable( bool state ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetTrainDirection( bool state );
return Native.Vehicle.SetTrainDerailable( this.GetUserData(), state );
}
public bool SetTrainDirection( bool state ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetTrainSpeed( float speed );
return Native.Vehicle.SetTrainDirection( this.GetUserData(), state );
}
public bool SetTrainSpeed( float speed ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetHeadLightColor( Color color );
return Native.Vehicle.SetTrainSpeed( this.GetUserData(), speed );
}
public bool SetHeadLightColor( Color color ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetTurretPosition( float x, float y );
return Native.Vehicle.SetHeadLightColor( this.GetUserData(), color );
}
public bool SetTurretPosition( float x, float y ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetDoorOpenRatio( int door, float ratio, int time = 0 );
return Native.Vehicle.SetTurretPosition( this.GetUserData(), x, y );
}
public bool SetDoorOpenRatio( int door, float ratio, int time = 0 ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetVariant( int variant1 = 255, int variant2 = 255 );
return Native.Vehicle.SetDoorOpenRatio( this.GetUserData(), door, ratio, time );
}
public bool SetVariant( int variant1 = 255, int variant2 = 255 ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool AddSirens( int sirenCount, int sirenType, bool flag360 = false, bool checkLos = true, bool useRandomiser = true, bool silent = false );
return Native.Vehicle.SetVariant( this.GetUserData(), variant1, variant2 );
}
public bool AddSirens( int sirenCount, int sirenType, bool flag360 = false, bool checkLos = true, bool useRandomiser = true, bool silent = false ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool RemoveSirens();
return Native.Vehicle.AddSirens( this.GetUserData(), sirenCount, sirenType, flag360, checkLos, useRandomiser, silent );
}
public bool RemoveSirens() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetSirens( int sirenPoint, Vector3 position, Color color = null, float minAlpha = 0.0f );
return Native.Vehicle.RemoveSirens( this.GetUserData() );
}
public bool SetSirens( int sirenPoint, Vector3 position, Color color = null, float minAlpha = 0.0f ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool SetPlateText( string text );
if( color == null )
return Native.Vehicle.SetSirens( this.GetUserData(), sirenPoint, position, color, minAlpha );
return Native.Vehicle.SetSirens( this.GetUserData(), sirenPoint, position, color, minAlpha );
}
public bool SetPlateText( string text )
{
return Native.Vehicle.SetPlateText( this.GetUserData(), text );
}
#endregion #endregion
#region Get #region Get
public Array GetSirens() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Array GetSirens();
return Native.Vehicle.GetSirens( this.userdata );
}
public Object GetSirenParams() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern object GetSirenParams();
return Native.Vehicle.GetSirenParams( this.userdata );
}
public string GetVehicleType() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern string GetVehicleType();
return Native.Vehicle.GetType( this.userdata );
}
public char[] GetVariant() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern char[] GetVariant();
return Native.Vehicle.GetVariant( this.userdata );
}
public VehicleColor GetColor() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern VehicleColor GetColor();
return Native.Vehicle.GetColor( this.userdata );
}
public static int GetModelFromName( string name ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool GetLandingGearDown();
return Native.Vehicle.GetModelFromName( name );
}
public bool GetLandingGearDown() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetMaxPassengers();
return Native.Vehicle.GetLandingGearDown( this.userdata );
}
public int GetMaxPassengers() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern string GetName();
return Native.Vehicle.GetMaxPassengers( this.userdata );
}
public string GetName() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Ped GetOccupant( int seat = 0 );
return Native.Vehicle.GetName( this.userdata );
}
public Ped GetOccupant( int seat = 0 ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Ped[] GetOccupants();
return Element.FindOrCreate( Native.Vehicle.GetOccupant( this.userdata, seat ) ) as Ped;
}
public IEnumerable<Ped> GetOccupants() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Ped GetController();
return Native.Vehicle.GetOccupants( this.userdata ).Select( i => Element.FindOrCreate( i ) as Ped );
}
public Ped GetController() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool GetSirensOn();
return Element.FindOrCreate( Native.Vehicle.GetController( this.userdata ) ) as Ped;
}
public bool GetSirensOn() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Vector3 GetTurnVelocity();
return Native.Vehicle.GetSirensOn( this.userdata );
}
public Vector3 GetTurnVelocity() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Vector3 GetTurretPosition();
return Native.Vehicle.GetTurnVelocity( this.userdata );
}
public Vector3 GetTurretPosition() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetUpgradeOnSlot( int slot );
return Native.Vehicle.GetTurretPosition( this.userdata );
}
public int GetUpgradeOnSlot( int slot ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern UInt32[] GetUpgrades();
return Native.Vehicle.GetUpgradeOnSlot( this.userdata, slot );
}
public UInt32[] GetUpgrades() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern UInt32[] GetCompatibleUpgrades( int slot = 0 );
return Native.Vehicle.GetUpgrades( this.userdata );
}
public UInt32[] GetCompatibleUpgrades( int slot = 0 ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetDoorState( int door );
return Native.Vehicle.GetCompatibleUpgrades( this.userdata, slot );
}
public int GetDoorState( int door ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern VehicleWheelsState GetWheelStates();
return Native.Vehicle.GetDoorState( this.userdata, door );
}
public VehicleWheelsState GetWheelStates() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetLightState( int light );
return Native.Vehicle.GetWheelStates( this.userdata );
}
public int GetLightState( int light ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetPanelState( int panel );
return Native.Vehicle.GetLightState( this.userdata, light );
}
public int GetPanelState( int panel ) [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetOverrideLights();
return Native.Vehicle.GetPanelState( this.userdata, panel );
}
public int GetOverrideLights() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Vehicle GetTowedByVehicle();
return Native.Vehicle.GetOverrideLights( this.userdata );
}
public Vehicle GetTowedByVehicle() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Vehicle GetTowingVehicle();
return Element.FindOrCreate( Native.Vehicle.GetTowedByVehicle( this.userdata ) ) as Vehicle;
}
public Vehicle GetTowingVehicle() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern int GetPaintjob();
return Element.FindOrCreate( Native.Vehicle.GetTowingVehicle( this.userdata ) ) as Vehicle;
}
public int GetPaintjob() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern string GetPlateText();
return Native.Vehicle.GetPaintjob( this.userdata );
}
public string GetPlateText() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool GetEngineState();
return Native.Vehicle.GetPlateText( this.userdata );
}
public bool GetEngineState() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool GetTrainDirection();
return Native.Vehicle.GetEngineState( this.userdata );
}
public bool GetTrainDirection() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern float GetTrainSpeed();
return Native.Vehicle.GetTrainDirection( this.userdata );
}
public float GetTrainSpeed() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern Color GetHeadLightColor();
return Native.Vehicle.GetTrainSpeed( this.userdata );
}
public Color GetHeadLightColor() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern float GetVehicleDoorOpenRatio( int door );
return Native.Vehicle.GetHeadLightColor( this.userdata );
}
public float GetVehicleDoorOpenRatio( int door )
{
return Native.Vehicle.GetVehicleDoorOpenRatio( this.userdata, door );
}
#endregion #endregion
#region Is #region Is
public bool IsTaxiLightOn() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsTaxiLightOn();
return Native.Vehicle.IsTaxiLightOn( this.GetUserData() );
}
public bool IsTrainDerailed() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsTrainDerailed();
return Native.Vehicle.IsTrainDerailed( this.userdata );
}
public bool IsTrainDerailable() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsTrainDerailable();
return Native.Vehicle.IsTrainDerailable( this.userdata );
}
public bool IsDamageProof() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsDamageProof();
return Native.Vehicle.IsDamageProof( this.userdata );
}
public bool IsFuelTankExplodable() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsFuelTankExplodable();
return Native.Vehicle.IsFuelTankExplodable( this.userdata );
}
public bool IsOnGround() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsOnGround();
return Native.Vehicle.IsOnGround( this.userdata );
}
public bool IsBlown() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsBlown();
return Native.Vehicle.IsBlown( this.userdata );
}
public bool IsLocked() [MethodImpl( MethodImplOptions.InternalCall )]
{ public extern bool IsLocked();
return Native.Vehicle.IsLocked( this.userdata );
}
#endregion #endregion