A small question regarding plugin creating [INVOKE A NATIVE]
#1

Hello.

Does anybody know how can I invoke "SendRconCommand" amx native in a plugin (so I want to call SendRconCommand from within my plugin). How do I get the address of that?
I would like to use the same SDK that MapAndreas uses, and do not want to use sampGDK (for performance and compatibility reasons).

Any help would be great.

Thanks in advance
KoczkaHUN

p.s: if it is easier, is there a way to load filterscripts and gamemodes from within a plugin? (This is why I want to have SendRconCommand, to let the server do the dirty job).
Reply
#2

Quote:
Originally Posted by KoczkaHUN
View Post
I would like to use the same SDK that MapAndreas uses, and do not want to use sampGDK (for performance and compatibility reasons).
sampGDK is either faster and supports Linux as far as I know, so there's no reason to not use it. If you really don't want it, search for invoke, it's easy to use.
Reply
#3

Quote:
Originally Posted by RyDeR`
View Post
sampGDK is either faster and supports Linux as far as I know, so there's no reason to not use it. If you really don't want it, search for invoke, it's easy to use.
I have heard if there are more than one sampGDK plugins are loaded at once, they mess up each other.
Also I would not want to have all those functionality, I want only one native function.

If you would help me by showing an example how to invoke it, I would thank you because this is why I created this thread.
Reply
#4

Sure. I suggest using the invoke plugin by Incognito (which you can find in his Streamer Plugin). It's a lot better then the other one since it stores all address on load.
- Extract "Invoke.cpp" and "Invoke.h" from the "Source" map
- Remove unnecessary things in "Invoke.h" and add the things you need (like SendRconCommand)
- Include "Invoke.h"
- Add under "Load":
pawn Code:
invoke = new Invoke;
- Add under "AmxLoad":
pawn Code:
invoke->amx_list.push_back(amx);
- Add under "AmxUnload":
pawn Code:
for (std::list<AMX *>::iterator i = invoke->amx_list.begin(); i != invoke->amx_list.end(); ++i)
{
    if (* i == amx)
    {
        invoke->amx_list.erase(i);
        break;
    }
}
- And use for example:
pawn Code:
invoke->callNative(&PAWN::SendRconCommand, "gmx");
P.S.: make sure you pre-use SendRconCommand so it's compiled in your amx file, otherwise it won't work.
Reply
#5

Thank you for the help. I will show you in the credits of my upcoming plugin release (within a few days).
Reply
#6

Here you are:

http://solidfiles.com/d/84a81b894f/

I'm not sure it works since i didn't tested but i believe it does :3

Edit: Hehe Ryder was faster...
Reply
#7

Thanks for your help, too.
Reply
#8

I've forgot something on the package, if you have downloaded it, re-download.

Anyways no problem.
Reply
#9

Thanks, I've redownloaded it, and see what can I make of these
Reply
#10

My plugin development guide as a section regarding invoke (getting started, adding natives, hooking callbacks, and how to use it). It also has a hell of a lot more information you should know if your going to be creating plugins, so go check it out.

https://sampforum.blast.hk/showthread.php?tid=295798.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)