Jump to content

MTA:SA Module Devkit


icedsun

Recommended Posts

Posted

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.

Posted

im not very good with lua at the moment but i will look and see if i can load a .exe with a lua script, in the mta race mod i could load itunes up from within game and change the song and stuff but i dont know about lua altho i will try :)

Posted

If that functionality is already there, I would be quite happy!!! (And something amazing would be added to my server... not going to spoil it yet though.)

Posted

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") 
  

Posted

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!!!

  • 2 weeks later...
  • Recently Browsing   0 members

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