Author Topic: Is there an event mod that can run commands? (explanation inside)  (Read 513 times)

I'm making a spaceship with a power switch. When I turn it off, I want it to run the command /setgravity 0 (from the Server_MapProperties mod) so it seems like the ship's gravity generator lost power. Is there any mod that can run a custom command like this through an event?

I'm making a spaceship with a power switch. When I turn it off, I want it to run the command /setgravity 0 (from the Server_MapProperties mod) so it seems like the ship's gravity generator lost power. Is there any mod that can run a custom command like this through an event?

The problem with such a mod is that it could not possibly be made secure in any way.  Being able to execute arbitrary code via events is just asking for someone to come and abuse the stuff out of it.  Hopefully they will only crash your server with it or ban all ids from 0 to 100000, but they might be more malicious and inject code or delete blockland files.  Even if it only ran /commands, it would be bad if it bypassed admin requirements.

Or just do an event that only does the gravity command, ya?

This is my quick attempt to make such a mod:

Code: [Select]
registerOutputEvent("fxDTSBrick","SendCommand","string 200 256",1);

function fxDTSBrick::SendCommand(%brick, %arg, %client)
{
%owner = %brick.client;
%command = getword(%arg, 0);
%rest = getwords(%arg, 1);

call("serverCmd" @ %command, %owner, %rest);
}

This is probably about as secure as you can get, it uses the brick owner as the permission level for the command.

To use it, you would put the event on a brick, make it self targeted, and put "setgravity 0" into the text box (minus quotes of course)

Link: https://dl.dropboxusercontent.com/u/20459676/Server_SendCommand.zip
« Last Edit: April 02, 2014, 09:27:10 PM by Nexus »

This is my quick attempt to make such a mod:

Code: [Select]
registerOutputEvent("fxDTSBrick","SendCommand","string 200 256",1);

function fxDTSBrick::SendCommand(%brick, %arg, %client)
{
%owner = %brick.client;
%command = getword(%arg, 0);
%rest = getwords(%arg, 1);

call("serverCmd" @ %command, %owner, %rest);
}

This is probably about as secure as you can get, it uses the brick owner as the permission level for the command.

To use it, you would put the event on a brick, make it self targeted, and put "setgravity 0" into the text box (minus quotes of course)

Link: https://dl.dropboxusercontent.com/u/20459676/Server_SendCommand.zip

Holy forget you are awesome, thank you!