Add ability to get path to AMX file (for plugin developers)
#1

I think I mentioned this in some other suggestions topic a couple of versions back:

It would be great if there was a way to get the path to the .amx file from which the AMX has been loaded. This is extremely useful for plugins that need to load debug info from .amx files.

The current method that I'm using is looping through all .amx files in the gamemodes and filterscripts directories and loading them and seeing if the headers are identical. But this is kind of ugly, plus files outside of standard folders won't get loaded (there's a workaround though but it requires additional user effort).

I see 3 possible solutions (not necessarily mutually exclusive):

1) Add support for an AmxLoadEx() function which would be similar to AmxLoad() but would take an additional "const char *path" parameter.

2) Export a new plugin API for retrieving the path via ppPluginData, something like "const char *GetAmxPath(AMX *amx)".

3) Export a native function - some scripts could benefit from this (e.g. introspect.inc by Slice) and it would still be callable from plugins (although not quite as easily).

Thanks!
Reply
#2

Another way is read server.cfg file and parse gamemode0 or filterscripts var, look this http://forum.sa-mp.com/showpost.php?...41&postcount=9
Reply
#3

True, but that wouldn't work for filterscripts loaded via RCON and not listed in server.cfg.
Reply
#4

Quote:
Originally Posted by xeeZ
Посмотреть сообщение
True, but that wouldn't work for filterscripts loaded via RCON and not listed in server.cfg.
GetServerVarAsString pawn function doesn't do it? Sorry if im wrong, im newbie into plugin development.
Reply
#5

Quote:
Originally Posted by n0minal
Посмотреть сообщение
GetServerVarAsString pawn function doesn't do it? Sorry if im wrong, im newbie into plugin development.
I tried that once on the plugins line, it returned only 1 plugin while 6 plugins were actually loaded.
Reply
#6

Quote:
Originally Posted by Patrik356b
Посмотреть сообщение
I tried that once on the plugins line, it returned only 1 plugin while 6 plugins were actually loaded.
Yes, i saw this on wiki page: When filterscripts or plugins is specified as the varname, this function only returns the name of the first specified filterscript or plugin. This is a bug.

I think Kalcor just should fix this.
Reply
#7

It's really an important issue which I also suggest to support this. But I guess add support for AmxLoadEx is the best way of three suggested because it's more understandable and easy to use.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)