Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function follow_portal()
- -- replace "User" with the name of the user you want to follow
- local user = "User"
- -- replace "Portal" with the name of the portal
- local portal = "Portal"
- -- check if the user is in the same room
- if msdp.Room and msdp.Room.People then
- for _, person in ipairs(msdp.Room.People) do
- if person == user then
- -- if the user is in the same room, check if the portal is there too
- if msdp.Room.Items then
- for _, item in ipairs(msdp.Room.Items) do
- if item.Name == portal then
- -- if the portal is there, move through it
- send("enter " .. portal)
- return
- end
- end
- end
- cecho("<green>Couldn't find " .. portal .. " in this room.</green>\n")
- return
- end
- end
- end
- cecho("<green>Couldn't find " .. user .. " in this room.</green>\n")
- end
- -- bind the function to a key for easy access
- -- replace "Ctrl-p" with the key combination you want to use
- -- replace "Follow Portal" with the name you want to give to this functionality
- -- you can also choose to bind it to a button instead of a key
- function follow_portal_keypress()
- follow_portal()
- end
- bindKey("Ctrl-p", "Follow Portal")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement