AMXWrapperCore 1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package AMXWrapperCore --version 1.0.0
NuGet\Install-Package AMXWrapperCore -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AMXWrapperCore" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AMXWrapperCore --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: AMXWrapperCore, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install AMXWrapperCore as a Cake Addin #addin nuget:?package=AMXWrapperCore&version=1.0.0 // Install AMXWrapperCore as a Cake Tool #tool nuget:?package=AMXWrapperCore&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
EXAMPLE CODE FOR BEGINNERS
⚠️ Make sure your project is compiled as x86 bit assembly!
using System;
using AMXWrapperCore;
namespace AmxCoreExample
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
var amx = new AMX("testscript.amx");
amx.LoadLibrary(AMXDefaultLibrary.Core);
amx.LoadLibrary(AMXDefaultLibrary.String); //More string funcs
amx.LoadLibrary(AMXDefaultLibrary.DGram); //More string funcs
amx.LoadLibrary(AMXDefaultLibrary.Console); //More console funcs
amx.LoadLibrary(AMXDefaultLibrary.Float); //To have float support
//Check AMXDefaultLibrary.* for more.
//Basic example of fast native function registering.
amx.Register("mynative", (amx1, args1) =>
{
//args1 is holding all arguments possibly passed from the script. You should atp already know what argument has to be at which index.
Console.WriteLine("MYNATIVE: {0} | {1}", args1[0].AsString(), args1[1].AsFloat());
return 1;
});
//After we loaded all needed libs and registered all the natives
amx.ExecuteMain();
//Calling a public (callback) without params
/*AMXPublic p = amx.FindPublic("MyCoolPublic");
p.Execute();
*/
//Continue finding another public, passing various arguments
//p = amx.FindPublic("MyCoolPublicArgs");
//Attention! You are pushing something, not allocating like you'd think.
//This means the LAST VALUE that you will now push, will be at the first place. (Shifting)
//var ptr = amx.Push("Example string from C# host."); //ONLY "strings" need to be released in AMX after execution..
//amx.Push((int)16); //just the integer value 16.
//amx.Push((float)2.9); //Pushing a simple float
//FLOATS PASSED FROM SCRIPT:
/* If you ever happen to push an FLOAT that was passed from a script
* for example, you want to call publics between scripts and write a function for that
* .. you would use amx.Push((float)args1[index].AsFloat()); <- BUT THAT IS WRONG.
*
* (float)args1[count].AsCellPtr().Get().AsFloat() will work.*/
//p.Execute();
//amx.Release(ptr); //Mentioned earlier, for the strings pushed.
GC.Collect(); // To check for leaks
Console.ReadLine();
}
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net5.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
The original code is copyright by Tim Potze.