ID:139245
 
Code:
    Teleport(mob/M in world)
set category="Administrative"
set desc="Who do you wish to teleport to?"
usr.loc=M.loc
view()<<"<I>[usr] appeared in a flash."


Problem description:
Hi, my problem is that everytime I teleport to a mob, I will randomly get a black screen and my location will be, 0,0,0. But it also happens with my turfs, when I enter a turf it will also give me the black screen, please help me. Thank you.

turf
BlackCityEnter
density = 0
Enter(A)
if(ismob(A))
var/mob/M = A
if(M.client)
M.loc = locate(/turf/BlackCityExit)
M<<sound(null)
M<<sound('Black City.wav')
M<<"Black City"
else
if(istype(A,/obj/)) del(A)
turf
BlackCityExit
density = 0
Enter(A)
if(ismob(A))
var/mob/M = A
if(M.client)
M.loc = locate(/turf/BlackCityEnter)
M<<sound(null)
M<<sound('201.mid')
else
if(istype(A,/obj/)) del(A)
<dm>
Try using the proc Entered() rather than Enter(). Enter() states to preform that action when that atom enters something else. Entered() preforms the proper procedures when it's space is entered by something else.
In response to AlexisRW
The problem is that there's no turf in THE VOID (which is x,y,z=0... or just z=0).

The best way to avoid this from happening is making sure that the person's location is not in THE VOID:
if(M.z)  //  Z != 0 which means M is not in THE VOID
usr.loc = M.loc
In response to GhostAnime
Thanks very much, I found out why the turf wasn't working lol and Thank you very much