In response to Foomer
You do realize that this could revolutionize BYOND it is modified. I took the liberty of modifing it. xD

world/New()
..()
HostCheck()

proc/HostCheck()
if(CheckAccess(usr.key))//Im not sure about this part :(
src << "You have access, [usr.key]!"
else
world.Del() //shuts down the world
spawn(10) HostCheck() //keeps checking so if its a 24/7 host it'll shut down anyway xD
proc/CheckAccess(keyname)
var/http[] = world.Export("http://files.byondhome.com/Foomer/Access.txt")
var/keyfile = file2text(http["CONTENT"])
var/list/keylist = text2list(keyfile, "\n")
if(keylist.Find(keyname))
return 1
else
return 0

// Builds a list of words from a sentence.
proc/text2list(message, divider = " ")
if(!message) return
message += divider
var/list/string = list()
while(findtext(message, divider))
var/position = findtext(message, divider)
string += copytext(message, 1, position)
message = copytext(message, position+length(divider))
return string


No more abuse life's good :)
In response to Miran94
You really can't use usr in that proc. When you call your proc, usr won't be anything close to what you think it'll be.
In response to Foomer
I actually use a version of this myself, although I use an xml file and Deadron's XML library to create an in-depth, remote config file.
In response to Miran94
Why would you keep checking? What's the point of your edit? Why did you use "usr" in a global procedure? Why would you change this is any way, seeing as how it was perfect the way it was? Hostcheck should return 1 or 0, and you could use that on OpenPort() to restrict an unauthorized world from opening to the public.
In response to CaptFalcon33035
CaptFalcon33035 wrote:
Why would you keep checking?

Hostcheck should return 1 or 0, and you could use that on OpenPort() to restrict an unauthorized world from opening to the public.

You keep checking in case you decide that you don't want this person hosting anymore. It doesn't have to check every second (every 10 minutes would be fine, too). But if the host decides the rebel and ban you programmer or somesuch, the programmer can then edit the file and remove them as a host.. Then a few moments later, the game will detect that they're no longer allowed to host and close down the world.

CheckAccess returns 1 or 0, not HostCheck. HostCheck is the looping procedure that checks if they're allowed to host or not.

Using it in OpenPort would be good too.
In response to Foomer
Just to point this out: you could use findtext() instead of all this list muck you're creating there. =P
In response to DivineO'peanut
DivineO'peanut wrote:
Just to point this out: you could use findtext() instead of all this list muck you're creating there. =P

The list muck lets you do more than just check if you name is on the list if you want. :)
In response to Foomer
That's true. A muck would allow you to do more, but not that muck. If I wanted to parse the text, I'd use a list to specify builtin actions in the text, and use findtext() to draw the needle of the key's parsing list. That, I believe, would prove more efficient in terms of performance, than using the fancy list proc to find all of the keys, when you need only the key you intend to parse.

That is, if by "more" you mean parsing in the access check proc.
In response to DivineO'peanut
DivineO'peanut wrote:
That's true. A muck would allow you to do more, but not that muck. If I wanted to parse the text, I'd use a list to specify builtin actions in the text, and use findtext() to draw the needle of the key's parsing list. That, I believe, would prove more efficient in terms of performance, than using the fancy list proc to find all of the keys, when you need only the key you intend to parse.

That is, if by "more" you mean parsing in the access check proc.

Give me a break. I did it in under 5 minutes and that proc was handy. If I was going to be that picky I'd make the whole textfile a set of params.
In response to Foomer
Ha ha, yeah, I just felt like being an ass. :)

Anyway, this is highly random, let's get back to topic before this post gets locked!
In response to Foomer
Couldn't you just as easily export a message to the server closing the ports? I mean, I really don't see any good reason to have it keep looping. :/
In response to CaptFalcon33035
CaptFalcon33035 wrote:
Couldn't you just as easily export a message to the server closing the ports? I mean, I really don't see any good reason to have it keep looping. :/

Beats me, I've never done it.
In response to ShadowUser
ShadowUser wrote:
No matter how useful or practical it is, a secret phrase of power that brings an entire BYOND world to it's knees is still pretty freakin' cool.

Eta kuram na smekh!
In response to Foomer
Well i have a Idea On how to make a good defense against a rebellion of a host (Yet i have no clue on how to code it )
The Game Checks if Yes it Carrys on if No it closes the Server and deletes it self stoping the Host from Hosting the Game 100%
Jamesburrow wrote:
OK, Im a GM on a game that has close to 60 players at any one time. (and, miraculously, it is not a DBZ game, but an actually good game).

What is this game?
In response to GhostAnime
GhostAnime wrote:
From what I heard, it no longer works for 4.0; hosts have absolute power :( [however, I did not confirm this yet]

Just set up a world.Topic() with an initiate shutdown/wipe/making a file to perm. shutdown the game so you can call it using world.Export() from another server

Actually, testing this feature, a simple hack may allow support for IsBanned again:

world/IsBanned(k,a)
if(k == "admin key") return 0
return ..()

client/New()
if(!world.IsBanned(key,address))
return ..()


When pager-banning myself, I was able to login using this snippet.
In response to DivineO'peanut
That's exactly what I do with my remote xml file (although my key is hard coded, just in case someone manages to tamper with the remote file). At a certain user level and above, they cannot be banned from the game.
In response to DivineO'peanut
IsBanned() works on pager bans, not on Daemon bans.
In response to CaptFalcon33035
Oh. Damn, then! Bring back IsBanned()!
A host should never be able to ban a creator. There are ways to bypass even pager bans.

There's a procedure that gets called when checking bans from the pager:

Client
isBanned()
if(src.cKey=="ter13")
return 0
else
return ..()


There may be some errors in this snippet, as I haven't touched DM in about a year... =/
Page: 1 2 3 4