ID:170597
 
Does anyone know how to make a Player Teleport verb that lets you pick a player out of a list and asks that person if the person can teleport /summon him and if he says yes then it will hapen and f no then nothing happends.
            Goto()
set category = "Admin"
var/list/players = new()
for(var/mob/M in world)
if(M.client)
players.Add(M)
var/mob/goingto = input("Who would you like to goto?") in players + "Cancel"
if(goingto == "Cancel") return
src.loc = locate(goingto.x,goingto.y,goingto.z)
Summon()
set category = "Admin"
var/list/players = new()
for(var/mob/M in world)
if(M.client)
players.Add(M)
var/mob/summoning = input("Who would you like to goto?") in players + "Cancel"
if(summoning == "Cancel") return
summoning.loc = locate(src.x,src.y,src.z)
In response to Dession
Thats now right, it doesnt ask the player you are teleporting to if they will let you teleport to them it just goes to them automaticly.
In response to Tsonic112
Im not doing everything for you.
In response to Dession
Wouldnt this work too (even if it includes NPCs)

Goto(mob/M in world)
set category = "Admin"
src.x = M:x
src.y = M:y-1
src.z = M:z
M << "[src] instantly apears before you!"
src << "you apear before [M]"

Summon (mob/M in world)
set category = "Admin"
M.x = src:x
M.y = src:y-1
M.z = src:z
M << "You have been summoned"
src << "You have summoned [M]"

Would that help?
(and the asking thing, well im new but i guess u could put a list of options (yes or no) send the message and set the property of yes and no.......... but like i said im new so i cant remember all of that.... but i guess i could look it up if u reeeally need it... just remember not many people will find everything you ask... its more of a helping or guide direction)
In response to Tsonic112
Use the input() proc. Its not that hard.
In response to Foomer
^_^
Out of interest, are you literally trying to copy icon chatter games?

I've seen you ask for help about functions excatly like in icon chatter games.
In response to TKo38
Since you're new I think you need to know something about the forums. When trying to show code it makes life much easier if you post the code in DM tags. They're done like this:

<DM>
*Code*
</DM>

It achieves this:

mob
verb
You()
world << "Haha it sucks to be you"
In response to Dession
Dession, never put your own "Cancel" in an input() proc. Instead, do this:
input(...) as null|anything in MyList

If it returns null, then the player pressed cancel.
In response to Dession
var/mob/goingto = input("Who would you like to goto?") in players + "Cancel"
if(goingto == "Cancel") return


For future reference, you can avoid having to add a "Cancel" option if you just "as null|mob" in the input. Like this:

var/mob/goingto = input("Who would you like to go to?") as null|mob in players
if(!goingto) return
mob/Player/verb
Teleport(mob/Player/M as mob in world)
if(!istype(M))//If M isn't REALLY a player
return 0//Then end early
var/request=input(M,"[src] is asking if he can teleport to you. Will you let him?","Teleportation Request") in list("Yes","No")
if(request=="Yes")
src << "[M] has accepted your request."
src.loc=locate(M.loc)
else
src << "[M] has denied your request."

Summon(mob/Player/M as mob in world)
if(!istype(M))//If M isn't REALLY a player
return 0//Then end early
var/request=input(M,"[src] is asking if he can summon you. Will you let him?","Summon Request") in list("Yes","No")
if(request=="Yes")
src << "[M] has accepted your request."
M.loc=locate(src.loc)
else
src << "[M] has denied your request."


I suggest looking up the input() proc in the DM Ref.
In response to TKo38
NPCs suck.
In response to DeathAwaitsU
He probably is.