Jump to content

MTA:SA Module Devkit


icedsun

Recommended Posts

To any brave soul with the knowledge and expertise necessary to use the MTA:SA Module Devkit:

I'm in need of some help in compiling some pre-existing C code into a module for MTA:SA. I have no idea if it's even feasible. The program performs several sets of mathematic and comparator operations on a set of data, and returns an array of the computed results. Sounds simple enough to write in Lua, but due to the length of it - it would take a very long time to convert. So, if anyone has some experience compiling anything for the module devkit, I'd appreciate any help or advice you could give. (Even if it's: "That's just not possible to do.")

If it isn't an option, would anyone have any ideas on how to write a module for MTA:SA that would give serverside script the option to call/open a ".exe" file with arguments? (For instance, exporting a function like: executeFile(".\taco.exe 15A 99E 34B") Since I'm able to already compile that C program into a .exe, something like this would be a fair-enough workaround to accomplish the same thing (and probably easier to do than converting the whole program into a module.)

Any advice/help/information is always greatly appreciated. Thanks everyone.

Link to comment

The module devkit is indeed interesting to play with. I've only had a quick look at it but realising what you want shouldn't be too difficult.

EDIT:

You could add something like this in your module function.

  
system(lua_tostring ( luaVM, 1 )); 
  

Where the argument is a command string ("c:\\taco.exe 15A 99E 34B" for example)

EDIT:

I've attached the module (ml_system.dll). It's a dumb simple demonstration of executing an external file using a module. You can execute a file by calling executeFile(string absolutePathToFileIncludingParameters).

Example

  
executeFile("c:\\somerandomapp.exe param1 param2 param3") 
  

Link to comment

You're amazing - thank you for taking the time and effort to look into this and even compile a working library for me. This community is very lucky to have such dedicated, helpful, and courteous members. It's much appreciated. When I finish the fruits of my scripting labor, I hope you find the end result enjoyable... (more details to come as I near completion) Thanks again.

Wow, after figuring out the proper way to include modules, it worked perfectly! This will do exactly what I needed and I can't possible thank you enough!!!

Link to comment
  • 2 weeks later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...