ID:166330
 
Ok so I have a proc that gives host commands to the person hosting the game but I don't know how to call the proc when a person pushes the host button.

If somone can tell me how to do this or knows for a fact that there is no way to do please tell me.
If you want to just give them the host commands at Login(), do this:

client/proc/ishost()
return (!address || address == world.address || address == "127.0.0.1") //returns 1 if the client is the host

mob/proc/hostcommands() //replace this with your proc
src << "Host power!"

mob/Login()
if(client.ishost()) //check to see if the person who logged in is the host or not
hostcommands() //give them the host commands
..()


Or if you want to give them powers when they actually hit the host button:

client/proc/ishost()
return (!address || address == world.address || address == "127.0.0.1")

world
OpenPort()
for(var/mob/M in world) //loop through all the mobs in the world
if(M.client && M.client.ishost()) //locate the host
M.hostcommands() //give them power
..() //start hosting

mob/proc/hostcommands() //replace this with your proc
src << "Host power!"


In the future, please only post in Code Problems if you've actually got some code.
In response to DeathAwaitsU
Thanks and I realize now this should have gone in Developer How To