ID:270869
 
When u have a game and when someone hosts it for you that it says: Hosted by [key]. I've already seen it on other games but i have no clue how to do it lol.

basicaly i need some code
world
status = " Game name, version, HOSTED BY [Key]"


where the [key] is, there need to be the key of the host. It should go auto when someone hosts.
var/host = "unknown" as text

world/OpenPort(port) // when a new port opens
..(port)
host = gethost()

proc/gethost()
for(var/client/c)
if(c.address == world.address || !c.address)
// if c's address is same as world's address, or he doesn't have one(since his address is world.address)
return c
In response to DivineO'peanut (#1)
Naruto Ultimate!
Players Online: 1
Version: 9.3.5
Host:unknown]

--> each time when i host, it gives me unknown, but i'd like to have it, that it displays the key of person's hosting
In response to Ultimate Productions (#2)
var/host
mob
Login()//When you login
if(host==null)//If there is no host when you log in.
host=src.key//make the first person who logged in host.
world.status="Host: [host] is hosting [world.name]"
src.verbs+=/mob/host/verb/Ban//this is juss to give you an idea how to give host verbs
In response to Ultimate Productions (#2)
Ultimate Productions wrote:
Naruto Ultimate!
Players Online: 1
Version: 9.3.5
Host:unknown]

--> each time when i host, it gives me unknown, but i'd like to have it, that it displays the key of person's hosting

Duh, becuase you didn't update it.

world/status = "... hosted by (unknown)"

world/OpenPort(port)
..(port)

var/host = gethost()
world.status = "... hosted by [host]"

proc/gethost()
for(var/client/c)

if(c.address == world.address || !c.address)
return c

return "(unknown)"


There.
In response to Dark Emrald (#3)
That isn't safe, since a play could <code>Login()</code> before the host.
In response to DivineO'peanut (#5)
I use it all the time only downfall to it is your hosting with dream deamon ~~. There are other ways to do it, I use about 3 diffrent ways, thas juss one way I showed you.
In response to Dark Emrald (#6)
Like what Divine said, it's not safe...

What would happen if a player logs in first than the actual host, especially when a reboot occurs? HUH?! There's a very high chance of that actually happening and I did saw some games fall prey to those type of mistakes... not that I had a hand in it... nope... no sir-ee... I did not caused the collapse of some lame icon games... it's not like I banned those hosts ... >_>


- GhostAnime
In response to GhostAnime (#7)
Yu-p I know thas what I was trying to says it was juss one way tho. -.-
In response to Dark Emrald (#8)
Just because it can work, doesn't mean it can work properly. That isn't the result he would want, because it doesn't always result with the real host. Don't give out false advice, unless you are 100 % absolutely sure that it is going to work as wanted.

-Doh