SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 16/11/2011, 04:44 PM   #1
KoczkaHUN
Huge Clucker
 
KoczkaHUN's Avatar
 
Join Date: Jan 2010
Posts: 498
Reputation: 100
Default A small question regarding plugin creating [INVOKE A NATIVE]

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).
__________________
uıɐƃɐ oɔsǝʇ uı pɹɐoqʎǝʞ ʎnq ʇou llıʍ ı
-
Quote:
Originally Posted by WackoX
If i steal a television at a store, am i still legal if i put a sign on it saying "COPYRIGHT ELECTRONIC STORE"?
Quote:
[20:46:02] <balintx> What is the output of this PAWN code? printf("%d", random(100));
[20:46:11] <JaTochNietDan> WHO THE FUCK KNOWS
-
KoczkaHUN is offline   Reply With Quote
Old 16/11/2011, 04:59 PM   #2
RyDeR`
High-roller
 
RyDeR`'s Avatar
 
Join Date: Feb 2009
Location: Belgium
Posts: 2,929
Reputation: 700
Default Re: A small question regarding plugin creating [INVOKE A NATIVE]

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.
__________________

Sup?
RyDeR` is offline   Reply With Quote
Old 16/11/2011, 05:02 PM   #3
KoczkaHUN
Huge Clucker
 
KoczkaHUN's Avatar
 
Join Date: Jan 2010
Posts: 498
Reputation: 100
Default Re: A small question regarding plugin creating [INVOKE A NATIVE]

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.
__________________
uıɐƃɐ oɔsǝʇ uı pɹɐoqʎǝʞ ʎnq ʇou llıʍ ı
-
Quote:
Originally Posted by WackoX
If i steal a television at a store, am i still legal if i put a sign on it saying "COPYRIGHT ELECTRONIC STORE"?
Quote:
[20:46:02] <balintx> What is the output of this PAWN code? printf("%d", random(100));
[20:46:11] <JaTochNietDan> WHO THE FUCK KNOWS
-
KoczkaHUN is offline   Reply With Quote
Old 16/11/2011, 05:16 PM   #4
RyDeR`
High-roller
 
RyDeR`'s Avatar
 
Join Date: Feb 2009
Location: Belgium
Posts: 2,929
Reputation: 700
Default Re: A small question regarding plugin creating [INVOKE A NATIVE]

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.
__________________

Sup?
RyDeR` is offline   Reply With Quote
Old 16/11/2011, 05:24 PM   #5
KoczkaHUN
Huge Clucker
 
KoczkaHUN's Avatar
 
Join Date: Jan 2010
Posts: 498
Reputation: 100
Default Re: A small question regarding plugin creating [INVOKE A NATIVE]

Thank you for the help. I will show you in the credits of my upcoming plugin release (within a few days).
__________________
uıɐƃɐ oɔsǝʇ uı pɹɐoqʎǝʞ ʎnq ʇou llıʍ ı
-
Quote:
Originally Posted by WackoX
If i steal a television at a store, am i still legal if i put a sign on it saying "COPYRIGHT ELECTRONIC STORE"?
Quote:
[20:46:02] <balintx> What is the output of this PAWN code? printf("%d", random(100));
[20:46:11] <JaTochNietDan> WHO THE FUCK KNOWS
-
KoczkaHUN is offline   Reply With Quote
Old 16/11/2011, 05:24 PM   #6
SlashPT
High-roller
 
SlashPT's Avatar
 
Join Date: Sep 2009
Location: Hell
Posts: 1,973
Reputation: 116
Default Re: A small question regarding plugin creating [INVOKE A NATIVE]

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...
__________________

Zh3r0Jansish
SlashPT is offline   Reply With Quote
Old 16/11/2011, 05:27 PM   #7
KoczkaHUN
Huge Clucker
 
KoczkaHUN's Avatar
 
Join Date: Jan 2010
Posts: 498
Reputation: 100
Default Re: A small question regarding plugin creating [INVOKE A NATIVE]

Thanks for your help, too.
__________________
uıɐƃɐ oɔsǝʇ uı pɹɐoqʎǝʞ ʎnq ʇou llıʍ ı
-
Quote:
Originally Posted by WackoX
If i steal a television at a store, am i still legal if i put a sign on it saying "COPYRIGHT ELECTRONIC STORE"?
Quote:
[20:46:02] <balintx> What is the output of this PAWN code? printf("%d", random(100));
[20:46:11] <JaTochNietDan> WHO THE FUCK KNOWS
-
KoczkaHUN is offline   Reply With Quote
Old 16/11/2011, 05:31 PM   #8
SlashPT
High-roller
 
SlashPT's Avatar
 
Join Date: Sep 2009
Location: Hell
Posts: 1,973
Reputation: 116
Default Re: A small question regarding plugin creating [INVOKE A NATIVE]

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

Anyways no problem.
__________________

Zh3r0Jansish
SlashPT is offline   Reply With Quote
Old 16/11/2011, 05:35 PM   #9
KoczkaHUN
Huge Clucker
 
KoczkaHUN's Avatar
 
Join Date: Jan 2010
Posts: 498
Reputation: 100
Default Re: A small question regarding plugin creating [INVOKE A NATIVE]

Thanks, I've redownloaded it, and see what can I make of these
__________________
uıɐƃɐ oɔsǝʇ uı pɹɐoqʎǝʞ ʎnq ʇou llıʍ ı
-
Quote:
Originally Posted by WackoX
If i steal a television at a store, am i still legal if i put a sign on it saying "COPYRIGHT ELECTRONIC STORE"?
Quote:
[20:46:02] <balintx> What is the output of this PAWN code? printf("%d", random(100));
[20:46:11] <JaTochNietDan> WHO THE FUCK KNOWS
-
KoczkaHUN is offline   Reply With Quote
Old 16/11/2011, 08:14 PM   #10
Kyosaur
Gangsta
 
Kyosaur's Avatar
 
Join Date: Mar 2008
Location: USA - California
Posts: 973
Reputation: 349
Default Re: A small question regarding plugin creating [INVOKE A NATIVE]

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.

http://forum.sa-mp.com/showthread.php?t=295798.
Kyosaur is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Small question FireCat Scripting Help 4 01/11/2011 02:04 PM
small question? MARTLMHK Help Archive 2 04/01/2010 11:45 AM
Hello, small question balisticore Help Archive 4 29/08/2009 05:11 AM
a small question _diana_ Help Archive 13 09/06/2009 12:55 PM


All times are GMT. The time now is 11:16 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.