I've always wondered how to create a text file where you can add a key, which will auto-receive hoster commands when he logins in his server.
I have a game, and sometimes the people host it on their shell servers, which makes it hard to define who's the one hosting, I've seen on some games like Sunday the 19th a text file which can be edited to add the keys you want as Admins.
I can already choose GMs in runtime, but that's because I'm already coded as Owner. How can I do this? It'd be really helpful if there was a text file on the hosting files zip to give yourself Hoster Powers on Shell Server.
Really depends on how indepth you want the system to be, the easiest method is having a host.txt file that ONLY contains the key you want to gain hosting powers.
var/host_key = file2text("host.txt") If you want it to contain multiple values you'd have to write something up to split the text into a list so you can read the values, I recommend my string handler library's Split() function. Simply adding a comma-separated string to the list as above would not work since you're really doing just that, adding a long string of text to the list as a single item. var/file_text = file2text("host.txt") Then the file would be in the format "key1,key2,key3" etc.. Hope this helped! |
In response to Nadrew
|
|
Nadrew wrote:
Really depends on how indepth you want the system to be, the easiest method is having a host.txt file that ONLY contains the key you want to gain hosting powers. > var/host_key = file2text("host.txt") If you want it to contain multiple values you'd have to write something up to split the text into a list so you can read the values, I recommend my string handler library's Split() function. Simply adding a comma-separated string to the list as above would not work since you're really doing just that, adding a long string of text to the list as a single item. > var/file_text = file2text("host.txt") Then the file would be in the format "key1,key2,key3" etc.. Thank you so much! I'll add it to my game now (: |
You have to be careful about this though.
Someone could put an entry in their hosts file that reroutes that location of that text file to their own server, which means they can download the file to their own server and rehost it (modifying values to give themselves admin.) |
Uh, what? It's just loading a local file, there's nothing modifying your system's hosts file can change, it's not loading anything over the network. The only person with access to the file would be the host of the world, who would be the one needing to modify it in the first place.
|
Ah, I would have assumed he would have uploaded it to a file server somewhere so he could dynamically add hosts.
|
After creating the list, you can input in people into it.
This is how!
Hope this helps you! Make sure the player sepreate their keys using commas. Also, he has to create the file.