Author Topic: How do you make a script that will put something in the console?  (Read 551 times)

This is pretty simply put and straight foward - How do you make a script that will put something in the console?

See, I want to make something where you type /updatemods and it will put setModPaths(getModPaths()); into the console.

Please post if you are going to help!

                                -Me

If you're trying to execute some sort of script use (which I doubt you are considering putting text in the console won't execute stuff):
eval(%code);
or to call a function:
call("functionname",%arg1,%arg2,etc; (11 or so arguments accepted I believe)

If you are definately trying to put text in the console text edit box then get the GUI editor and play around in the console dialog.
« Last Edit: April 12, 2009, 02:10:37 AM by Destiny/Zack0Wack0 »

Make a file called "server.cs", put this in it:

Code: [Select]
function servercmdUpdateMods(%c)
{
     if(!%c.isSuperAdmin)
          return;

     setModPaths(getModPaths());
     messageClient(%c,'','\c2Mods have been updated.');
}

You'll need to package that as a Script_Something.zip (with a description.txt) and then tick it in the Add-Ons menu. I'm not sure what this will accomplish though, setModPaths(); will only refresh the resource manager (to detect files that have been deleted/added) and won't disable add-ons on your server or include ones you just installed. All the uiname lists are cached and then sent to the client along with the datablocks so you'd need to re-send all those too which would result in a bit of server lag.

Code: [Select]
eval(code);
or to update a file
Code: [Select]
exec("add-ons/file");