Jump to content

Script to run cmds from other scripts on toggle or start?


Drathian

Recommended Posts

Posted (edited)

I'm not sure if this is the right place to ask this but is it even possible in lua (i know some programing langauges have restrictions on that) to access the console command line from other scripts, ie: type something in console (server and/or client) at runtime or toggle?

For instance I have a few things that are settings that I don't wish to edit the script to make them defaults, but would rather enter commands at startup or toggle. Or is there a way to send commands via a text file kinda like: run file.txt

Thank you for reading, even more if you can provide any solution!

Edited by Guest
Posted

Not entirely sure what you're talking about, but do you mean settings for specific resources?

You can use getResourceConfig to name one of the ways. There are more, but this is probably the most common. You can edit the settings of resources via the admin panel.

Posted

I mean settings as in console commandline settings.

Say I have a mod that makes all cars pink by typing:

/pinky

and another script that has sky green:

/skygreen

How would i get them to auto type that at launch in the console:

aka

mta-startup.....

/pinky

/skygreen

Posted

Yeah i was checking to see if that could be done, I didn't think scripts could share local variables globally. What about a solution for client start?

Posted

So you can execute functions from other scripts directly hmm that is useful. I was thinking of reading commands from a list of some sort like a txt file. I guess that would have something to do with arrays which i'm terrible at.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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