Struct ICore
This type represents a pointer to an unmanaged open.mp ICore interface.
[OpenMpApi(new Type[] { typeof(IExtensible), typeof(ILogger) })]
public readonly struct ICore : IEquatable<ICore>, ICore.IManagedInterface, IExtensible.IManagedInterface, ILogger.IManagedInterface, IUnmanagedInterface
- Implements
- Inherited Members
Constructors
ICore(nint)
Initializes a new instance of the ICore struct.
public ICore(nint handle)
Parameters
handlenintA pointer to the unmanaged interface.
Properties
Handle
Gets the handle to the unmanaged interface instance.
public nint Handle { get; }
Property Value
HasValue
Gets a value indicating whether the pointer has a value.
public bool HasValue { get; }
Property Value
Methods
AddExtension<T>(T)
Adds the specified managed extension to this extensible.
public void AddExtension<T>(T extension) where T : Extension
Parameters
extensionTAn instance of the extension to add. The extension will be disposed if the extension could not be added to this extensible.
Type Parameters
TThe type of the managed extension.
Remarks
A managed extension can only be added to one extensible.
Exceptions
- ArgumentException
Throw when an instance of the extension type was already added to this extensible.
ConnectBot(string, string)
Attempt to connect a new bot to the server.
public void ConnectBot(string name, string script)
Parameters
Equals(ICore)
public bool Equals(ICore other)
Parameters
otherICore
Returns
Equals(object?)
public override bool Equals(object? other)
Parameters
otherobject
Returns
GetConfig()
Gets the server configuration.
public IConfig GetConfig()
Returns
- IConfig
Yhe server configuration.
GetEventDispatcher()
Gets the core event dispatcher.
public IEventDispatcher<ICoreEventHandler> GetEventDispatcher()
Returns
- IEventDispatcher<ICoreEventHandler>
The core event dispatcher.
GetExtension(UID)
Gets the extension with the specified id.
public IExtension GetExtension(UID id)
Parameters
idUIDThe identifier of the extension type.
Returns
- IExtension
The extension or null if the extension could not be found.
GetExtension<T>()
Gets the specified managed extension from this extensible.
public T GetExtension<T>() where T : Extension
Returns
- T
An instance of the extension with type
T.
Type Parameters
TThe type of the managed extension.
Exceptions
- ArgumentException
Thrown if the extension could not be found.
GetGravity()
Gets the server gravity.
public float GetGravity()
Returns
- float
The server gravity.
GetHashCode()
public override int GetHashCode()
Returns
GetNetworkBitStreamVersion()
Get the version of the NetworkBitStream class the core was built with.
public int GetNetworkBitStreamVersion()
Returns
- int
The version of the NetworkBitStream class.
GetNetworks()
Gets a list of available networks.
public FlatPtrHashSet<INetwork> GetNetworks()
Returns
- FlatPtrHashSet<INetwork>
A list of available networks.
GetPlayers()
Gets the player pool
public IPlayerPool GetPlayers()
Returns
- IPlayerPool
The player pool.
GetTickCount()
Gets the tick count.
public uint GetTickCount()
Returns
- uint
The tick count.
GetVersion()
Gets the version of the open.mp server.
public SemanticVersion GetVersion()
Returns
- SemanticVersion
The version of the open.mp server package.
GetVersionHash()
Gets the version hash of the open.mp server.
public string GetVersionHash()
Returns
- string
The version hash.
GetWeaponName(PlayerWeapon)
Get the name of a weapon.
public string GetWeaponName(PlayerWeapon weapon)
Parameters
weaponPlayerWeaponThe weapon.
Returns
- string
The name of the weapon.
LogLine(LogLevel, string)
Logs a new line to the console with the specified severity level.
public void LogLine(LogLevel level, string msg)
Parameters
LogLn(LogLevel, byte*)
Prints a new line to the console with the specified severity level.
public void LogLn(LogLevel level, byte* msg)
Parameters
LogLnU8(LogLevel, byte*)
Prints a new line to the console of the specified log type in UTF-8 encoding.
public void LogLnU8(LogLevel level, byte* msg)
Parameters
PrintLine(string)
Prints a new line to the console.
public void PrintLine(string msg)
Parameters
msgstringThe message to log.
PrintLn(byte*)
Prints a new line to the console.
public void PrintLn(byte* msg)
Parameters
msgbyte*The message to log.
PrintLnU8(byte*)
Prints a new line to the console in UTF-8 encoding.
public void PrintLnU8(byte* msg)
Parameters
msgbyte*The message to log.
QueryExtension<T>()
Gets the specified unmanaged extension from this extensible.
public T QueryExtension<T>() where T : unmanaged, IExtension.IManagedInterface
Returns
- T
The unmanaged extension or null if the extension could not be found.
Type Parameters
TThe type of the unmanaged extension.
ReloadAll()
Create all entities that appear on GM start.
public void ReloadAll()
RemoveExtension(IExtension)
Removes the specified extension from this extensible.
public void RemoveExtension(IExtension extension)
Parameters
extensionIExtensionThe extension to remove.
Exceptions
- ArgumentException
Thrown if the extension could not be found.
RemoveExtension(UID)
Removes the extension with the specified id from this extensible.
public void RemoveExtension(UID id)
Parameters
idUIDThe identifier of the extension.
Exceptions
- ArgumentException
Thrown if the extension could not be found.
RemoveExtension<T>(T)
Removes the specified managed extension from this extensible.
public void RemoveExtension<T>(T extension) where T : Extension
Parameters
extensionTThe managed extension to remove.
Type Parameters
TThe type of the managed extension.
Exceptions
- ArgumentException
Thrown if the extension could not be found.
ResetAll()
Clear all entities that vanish on GM exit.
public void ResetAll()
SetData(SettableCoreDataType, string)
Sets string data during runtime.
public void SetData(SettableCoreDataType type, string data)
Parameters
typeSettableCoreDataTypeThe type of the data.
datastringThe data value.
SetGravity(float)
Sets the server gravity.
public void SetGravity(float gravity)
Parameters
gravityfloatThe server gravity.
SetThreadSleep(Microseconds)
Sets the sleep value for each main thread update cycle.
public void SetThreadSleep(Microseconds value)
Parameters
valueMicrosecondsThe sleep duration.
SetWeather(int)
Sets the server weather.
public void SetWeather(int weather)
Parameters
weatherintThe server weather.
SetWorldTime(TimeSpan)
Sets the server world time.
public void SetWorldTime(TimeSpan time)
Parameters
timeTimeSpanThe world time, truncated to whole hours on the native side.
TickRate()
Gets the ticks per second.
public uint TickRate()
Returns
- uint
Ticks per second.
TryGetExtension<T>()
Tries to get the specified managed extension from this extensible.
public T? TryGetExtension<T>() where T : Extension
Returns
- T
An instance of the extension with type
Tor null if no extension with the specified type could be found.
Type Parameters
TThe type of the managed extension.
TryQueryExtension<T>(out T)
Tries to get the specified unmanaged extension from this extensible.
public bool TryQueryExtension<T>(out T extension) where T : unmanaged, IExtension.IManagedInterface
Parameters
extensionTThe extension if found, otherwise null.
Returns
Type Parameters
TThe type of the unmanaged extension.
UseDynTicks(bool)
Toggle dynamic ticks instead of static duration sleep.
public void UseDynTicks(bool enable)
Parameters
UseStuntBonuses(bool)
Toggles server stunt bonuses.
public void UseStuntBonuses(bool enable)
Parameters
Operators
operator ==(ICore, object?)
Determines whether the specified values are equal.
public static bool operator ==(ICore lhs, object? rhs)
Parameters
lhsICoreThe value on the left side of the operator.
rhsobjectThe value on the right side of the operator.
Returns
- bool
trueif the values are equal; otherwise,false.
explicit operator IExtensible(ICore)
Casts the ICore to a IExtensible.
public static explicit operator IExtensible(ICore value)
Parameters
Returns
- IExtensible
The converted IExtensible.
explicit operator ILogger(ICore)
public static explicit operator ILogger(ICore value)
Parameters
Returns
explicit operator ICore(IExtensible)
Casts the IExtensible to a ICore.
public static explicit operator ICore(IExtensible value)
Parameters
valueIExtensibleThe IExtensible to cast.
Returns
explicit operator ICore(ILogger)
public static explicit operator ICore(ILogger value)
Parameters
Returns
operator !=(ICore, object?)
Determines whether the specified values are not equal.
public static bool operator !=(ICore lhs, object? rhs)
Parameters
lhsICoreThe value on the left side of the operator.
rhsobjectThe value on the right side of the operator.
Returns
- bool
trueif the values are not equal; otherwise,false.