ID:270412
 
I want to make my game free for download, but not free for hosting.How i do that?

Sorry for bad english [>.<]'
Probably the best way is to create a "permission server" that allows/disallows games from being hosted.

Put in a "permission code" and "permission hash" variable in the game, and then host your permission server. If the game's permission code and hash matches the permission server's code and hash, you can assume that the person has permission. So, you can offer free downloads, but make people pay for "permission" to host.
Like PirateHead said, you can use some sort of server that tells if a person can host or not, or you can create a list of ckeys in the game (though some people might tell you not to hardcode this, they're probably right) that can host.

Then, simply manipulate OpenPort() to suit your needs. If the host's ckey is not in the list (you have to find this out when the person logs in), then don't let them host. return 0
In response to CaptFalcon33035
oh, like:
world/OpenPort(port)
// only allow subscribers to host
if(host.key == "" || src.key == "") // in this part i use host or src?
return ..()
In response to Pharaoh Atem
I would use src.key, but thats just me. Anyone can host with DreamDaemon though.
In response to XzDoG
=O
then, i will send the game via msn, until i make the open beta...
Pharaoh Atem wrote:
I want to make my game free for download, but not free for hosting.How i do that?

Sorry for bad english [>.<]'

Check to see if a client is the host upon connecting, and set a host variable equal to them. Then, use the BYOND subscription system, and override world.OpenPort.

var/client/Host

client/New()
if(src.address==null||src.address==world.address)
Host=src
..()

world/OpenPort()
if(Host.CheckPassport("STRING_FROM_HUB"))
..()
else
Host<<"You must subscribe!"
return 0


I'm 99% sure that will work, though I don't know if you can use a var/client like that.

[edit]
They would still be able to host on dreamdaemon this way. What you can do, however, is:

world
New()
if(world.port!=0)
CRASH("You may not host with DreamDaemon.")
else
..()
In response to Airjoe
=o thank you.
I was thinking:
world
hub = "hahahaha.mwahahahaha"

Inuyashaisbest wrote:
That Also Interferes with Reboot Use This Instead

No talk like headline. Ungh.

world/New()
..()
spawn(5)
var/Found=0
for(var/client/C)
Found=1;break

Problems there: 1) You're spawning too long, and 2) your client loop is atrocious.

There are two ways to fix the loop. One is to use locate():
var/client/C = locate()

Very simple. Another is to still loop, but not use the Found var because it's not only silly, but using capitalized var names is wrong.
var/client/C
for(C) break
// if C is null, no client was found

Lummox JR
mob
Login()
if(!src.client.address)
..()
else
src << "Sorry. This game was meant to be non-hosteable. Bye bye."
del src

This should do the job...
Isso deve fazê o trabalho...
Eso debe hacer el trabajo...