-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugin adaptation for NodeSamp #25
Comments
same problem. see katursis/Pawn.RakNet#53.
samp.registerEvent("OnIncomingPacket", "iii");
samp.on("OnIncomingPacket", (playerid: number, packetid: number, bs: number) => {
console.log("nerver callback");
});
}; However, this can be used directly in streamer, it is not clear how the implementation inside the pawn.raknet plugin and between the open.mp-gdk plugin differs from the traditional plugin for streamer |
This problem has lasted for a long time. |
Invoke native solutionsNow, a rather silly solution is to use custom public functions to manually pass arguments and return the native function's return value. If we pass the wrong parameter, the server will simply kill the process without any error notification. forward BitStream:RakNetNative(...);
public BitStream:RakNetNative(...)
{
new idx = getarg(0);
switch(idx)
{
case 0:
{
return BS_New();
}
case 1:
{
return BS_NewCopy(BitStream:getarg(0, 1));
}
}
return BitStream:-1;
} samp.on("OnGameModeInit", () => {
const bs = samp.callPublic("RakNetNative", "a", [0]);
console.log(bs);
const bs_copy = samp.callPublic("RakNetNative", "a", [1, bs]);
console.log(bs_copy);
}); Why am I passing it in an array instead of one by one?Because when i pass a number by The second argument to For the UntestedI haven't tested for compatibility with callbacks, but it should be possible to write raknet's callback in pawn, return For the second parameter of a function like PerformanceIn order to achieve syntax compatibility for samp or omp, some small sacrifices need to be made, but the overhead can be negligible. The amx of gamemode only did a small part of the work, such as calling an extra layer of function stack. What we should focus on is developing libraries that wrap around commonly used plugins for samp/omp, expanding the ecosystem for writing server scripts in node, rather than being stuck in a situation where there are no "wheels". Once in the node.js ecosystem, it's easy to use some commonly used libraries like mysql, so we no longer need to wrap samp's mysql plugin. We can also give up the timers in pawn language and directly use the native ones in node, which have more convenient asynchronous writing methods. |
You can try using the latest infernus and infernus-starter, which internally uses a stupid way to implement |
I am interested in such a question, will there be an adaptation of the Pawn.Raknet plug-in for NodeSamp?
The text was updated successfully, but these errors were encountered: