Advertisement
cnl_cnl_cnl

Untitled

Feb 14th, 2023
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. function follow_portal()
  2. -- replace "User" with the name of the user you want to follow
  3. local user = "User"
  4.  
  5. -- replace "Portal" with the name of the portal
  6. local portal = "Portal"
  7.  
  8. -- check if the user is in the same room
  9. if msdp.Room and msdp.Room.People then
  10. for _, person in ipairs(msdp.Room.People) do
  11. if person == user then
  12. -- if the user is in the same room, check if the portal is there too
  13. if msdp.Room.Items then
  14. for _, item in ipairs(msdp.Room.Items) do
  15. if item.Name == portal then
  16. -- if the portal is there, move through it
  17. send("enter " .. portal)
  18. return
  19. end
  20. end
  21. end
  22. cecho("<green>Couldn't find " .. portal .. " in this room.</green>\n")
  23. return
  24. end
  25. end
  26. end
  27. cecho("<green>Couldn't find " .. user .. " in this room.</green>\n")
  28. end
  29.  
  30. -- bind the function to a key for easy access
  31. -- replace "Ctrl-p" with the key combination you want to use
  32. -- replace "Follow Portal" with the name you want to give to this functionality
  33. -- you can also choose to bind it to a button instead of a key
  34. function follow_portal_keypress()
  35. follow_portal()
  36. end
  37. bindKey("Ctrl-p", "Follow Portal")
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement