ID:267101
Dec 6 2002, 4:41 am
|
|
How would the host of a game get some special verbs?
|
Dec 6 2002, 1:10 pm
|
|
use the demo or it might be a library i dont remember but i've seen one before
|
var
HOST="" mob/Stat() usr.verbs.Add(/mob/Host/verb/Host_Boot) usr.verbs.Add(/mob/Host/verb/Start_Game) usr.verbs.Add(/mob/Host/verb/Host_Change_People_allowed) usr.verbs.Add(/mob/Host/verb/Host_Summon) usr.verbs.Add(/mob/Host/verb/Host_Summon_All) HOST=usr.key usr.verbs.Add //HOST VERBS// mob/Host/verb/Start_Game() set category = "Host" world.visibility = 0 world.status = "Game in Progress" world<<"<SPAN STYLE='color: red ; font-size: 20pt ; font-weight: bold ; font-style: '>THE GAME HAS BEGUN!</SPAN><STYLE>" mob/Host/verb/Host_Boot(mob/M in world) set category="Host" del(M) usr<<"You Booted [M]" mob/Host/verb/Host_Change_People_allowed(n as num) set category="Host" maxpeople=n usr<<"You changed the number of people allowed to [n]" mob/Host/verb/Host_Summon(mob/M in world) set category="Host" if(!M.client) return else M.loc=usr.loc mob/Host/verb/Host_Summon_All() set category="Host" for(var/mob/M in world) if(!M.client) ..() else M.loc=usr.loc mob/Host/verb/Host_Mute(mob/M in world) set category="Host" if(M.Muted==0) M.Muted=1 M<<"You have been muted by the host" else M.Muted=0 world<<"[usr] has been unmuted by [M]" //MOB VERBS// mob/verb/Say(msg as text) if(usr.Muted==1) usr<<"..." else world<<"[usr]: [msg]" I think this is what you are looking for. Tell me if there are any errors because I didn't bother to compile it. |
In response to RainZero
|
|
Its a very long time from your post, Rain Zero, but i still have a question. How can you receive host verbs if you are hosting it?
|
In response to Unknown Person
|
|
The host would be the first person to logon... because at first they'd just be running, then they'd hit the 'Host' button.
|
In response to Nova2000
|
|
Not always - if you get unlucky, it's possible for somebody else to connect first when you reboot the server.
A more reliable way is to check the value of <code>client.address</code> to see if <code>client</code> is the host. If <code>client.address</code> is null, equal to <code>world.address</code>, or equal to "127.0.0.1", then the client is the host: <code>var/client/host=null //Global var that says who the host is client/New() if (!host && (!client.address || client.address==world.address || client.address=="127.0.0.1")) host=src .=..()</code> |
In response to Crispy
|
|
There is a problem, when i use that code, this happens..
Main.dm:137:error:client.address:undefined var Main.dm:137:error:client.address:undefined var Main.dm:137:error:client.address:undefined var It points to the "host=src" part.. Anybody able to help me> |
In response to Unknown Person
|
|
No client, just address.
|
In response to Garthor
|
|
Whoops, my bad. That's what happens when you transplant code from mob/Login() straight into client/New(). :-)
|