42 posts
Posted 15 May 2013 - 03:00 AM
Hello, on my server I am using the stargates plugin, and I want to disable the dialing of gates by commands for regular players, so that they have to provide the required materials to create the address.
However at public gates I would like to offer dialing computers, that will load from a floppy disk, and get the name of the computer it is on (which will match the gate origin name), and then execute the dial command to connect the two gates.
My question is, is there a way to execute an operator only command with computercraft, or a way to make a special permission class specifically for computer craft, and if so, what would an example code/config look like?
Thanks!
200 posts
Location
Scotland
Posted 15 May 2013 - 09:50 AM
Yes, use command blocks and wrap it as a peripheral (Also needs to be enabled in the configs)
Make sure you hide the command block too, they can be quite dangerous!
I would give an example but I can't remember the functions off the top of my head for command blocks.Edit:
http://computercraft.info/wiki/Command_Block_(API)
42 posts
Posted 15 May 2013 - 09:38 PM
Thanks for the link. Just a quick question though, wouldn't anyone with access to a terminal be able to hack it? (unless I somehow made it so it was impossible to edit the program)
Is there a way I can prevent the files on a pc from being edited without a password? To prevent users from hijacking the command block.
2217 posts
Location
3232235883
Posted 15 May 2013 - 09:50 PM
bedrock / permissions and os.pullEvent=os.pullEventRaw
42 posts
Posted 15 May 2013 - 09:57 PM
bedrock / permissions and os.pullEvent=os.pullEventRaw
I meant from hacking the terminal, I just wanna know how to prevent them from exiting the default program and being able to edit the code, to write things to the command block they shouldn't.
2217 posts
Location
3232235883
Posted 15 May 2013 - 10:00 PM
os.pullEvent=os.pullEventRaw
42 posts
Posted 15 May 2013 - 10:05 PM
os.pullEvent=os.pullEventRaw
Thank you, I appreciate your help, but I am too much of a noob to know where to put this. At the top line of my code?
645 posts
Location
'Merica
Posted 15 May 2013 - 10:13 PM
os.pullEvent=os.pullEventRaw
Thank you, I appreciate your help, but I am too much of a noob to know where to put this. At the top line of my code?
It doesn't really matter, well it does, like if you do not want it to be hackable after 3 seconds then do sleep(3) then os.pullEvent = os.pullEventRaw …its safer to have it at the top of your code though.
42 posts
Posted 16 May 2013 - 02:57 AM
Hello, thanks for all the help so far, I've started to get together a basic program to do what I want. I seem to have stumbled onto one more problem.
When I call the command it will return 8-10 lines of text
ex:
Chevron 1 Engaged
Chevron 2 Engaged
Chevron 3 Engaged
Chevron 4 Engaged
Chevron 5 Engaged
Chevron 6 Engaged
Chevron 7 Engaged
Gate Connection [Active/Failed] (reason)
This text is normally sent to the chat of the player who calls the command, is there any way to capture this text(to show on a monitor)?
2217 posts
Location
3232235883
Posted 16 May 2013 - 10:07 AM
term.redirect(peripheral.wrap("side"))
then
term.restore()
afterwards
686 posts
Posted 16 May 2013 - 01:29 PM
Yes, use command blocks and wrap it as a peripheral (Also needs to be enabled in the configs)
Make sure you hide the command block too, they can be quite dangerous!
I would give an example but I can't remember the functions off the top of my head for command blocks.Edit:
http://computercraft...and_Block_(API)
Non ops cannot edit command blocks, so there's no need to worry about that.
200 posts
Location
Scotland
Posted 16 May 2013 - 03:38 PM
Yes, use command blocks and wrap it as a peripheral (Also needs to be enabled in the configs)
Make sure you hide the command block too, they can be quite dangerous!
I would give an example but I can't remember the functions off the top of my head for command blocks.Edit:
http://computercraft...and_Block_(API)
Non ops cannot edit command blocks, so there's no need to worry about that.
No but the computer can
42 posts
Posted 16 May 2013 - 05:32 PM
term.redirect(peripheral.wrap("side"))
then
term.restore()
afterwards
Thanks, works like a charm, however, I was wondering if there would be a way to process the data as it comes in, for example, checking if each line contains a certain text, for example waiting for the command to either say an error has occured, OR waiting for it to say the gate has disconnected, before allowing the user to input a new address?