Use publics inside a plugin
#7

Quote:
Originally Posted by me-borno
View Post
Ok, I tried a couple of things to make this working.
But it didnt work out.

So I found out I didn't ask the right question, so once again.

How can I juse Natives (such as GetPlayerPos) inside my DLL?

I tried things like:
amx_FindNative to get the address.
and this to 'compare'.

Hope someone can help me out.
Check out the invoke script incognito made for his streamer plugin. To get it setup (without dependencies) you need to change all of his unordered_maps into regular STL maps, allocate memory for the "invoke" pointer (do this upon load), push_back the amx_list on amxload, and delete the AMX instance from the amx_list when AmxUnload is called.

Thats how you correctly set it up. To get it working you have to call the memeber function getAddresses (i suggest on GM load), and you have to add your own natives (it currently only contains object related natives). You add the native's names to the list of names in invoke.h, and you fill the Native structure for it right below that (try to follow the pattern of the ones already there if you dont know what your doing). Once thats done, simply add a call to the native function in a public PAWN function (one thats not for use...this function should contain a call for every function you add to invoke... the functions have to be used in a public in order to get their addresses.).

Edit:

Im gonna upload my current one, it has more natives (converted them from peters' old PawnCommand), and uses it uses standard maps. You still have to set it up for yourself though (gotta allocate memory, push the amx_list back, and delete an item from amx_list when AmxUnload is called).

Here' the PAWN function containing all the defined natives (You'd want to add this in an include. I personally have it in my PAWN GM, as my real GM is a plugin):

http://pastebin.com/7d9yzwPg

Here's the invoke script by incognito:

http://www.sendspace.com/file/uuwpx1



Note: Make sure every time you add a native (i do it on an as needed basis) you add it to that PAWN function, or you'll get a run-time error.
Reply


Messages In This Thread
How to use Natives inside a Plugin - by me-borno - 30.06.2011, 06:53
Re: Use publics inside a plugin - by Benzodiazepine™ - 30.06.2011, 07:49
Re: Use publics inside a plugin - by 0x5A656578 - 30.06.2011, 13:37
Re: Use publics inside a plugin - by me-borno - 30.06.2011, 20:34
Re: Use publics inside a plugin - by Pghpunkid - 30.06.2011, 20:37
How to use Natives inside a Plugin - by me-borno - 07.07.2011, 21:40
Re: How to use Natives inside a Plugin - by Kyosaur - 07.07.2011, 21:55
Re: How to use Natives inside a Plugin - by me-borno - 07.07.2011, 22:09
Re: How to use Natives inside a Plugin - by Kyosaur - 07.07.2011, 22:16
Re: Use publics inside a plugin - by 0x5A656578 - 08.07.2011, 05:05
Re: Use publics inside a plugin - by Kyosaur - 08.07.2011, 05:22
Re: Use publics inside a plugin - by me-borno - 08.07.2011, 09:29
Re: Use publics inside a plugin - by Kyosaur - 08.07.2011, 18:09
Re: Use publics inside a plugin - by me-borno - 08.07.2011, 18:24
Re: Use publics inside a plugin - by 0x5A656578 - 12.07.2011, 10:14
Re: Use publics inside a plugin - by 0x5A656578 - 12.07.2011, 10:32
Re: Use publics inside a plugin - by Incognito - 12.07.2011, 10:42
Re: How to use Natives inside a Plugin - by Mauzen - 24.07.2011, 12:32
Re: How to use Natives inside a Plugin - by Kyosaur - 24.07.2011, 18:45

Forum Jump:


Users browsing this thread: 1 Guest(s)