Jump to content

Teleport - Goto System


Behnam

Recommended Posts

Hi
I want a script for goto to player and teleport player

Script For Admin ACL !

For Goes To Player:

outputChatBox For Admin :

You Have Been Teleported To Player Name

outputChatBox For Player:

Admin Behnam Have Been Teleported To You

 

And For Teleport To Player:

outputChatBox For Admin:

The Player Name Teleported To You

outputChatBox For Player:

You Have Been Teleported By AdminName

Thanks !

Sorry for my bad english

@Galactix You can give me a script ?

Link to comment

function verify()
local players = getElementsByType ( "player" )
for k,v in ipairs(players) do
   local accountname = ""
   if (isGuestAccount(getPlayerAccount(v)) == false) then
      accountname = getAccountName (getPlayerAccount(v))
 
if isObjectInACLGroup("user." .. accountname, aclGetGroup ( "Admin" )) then
return true else return false
end
end
end
end

function teleport(plr,cmd,r)
if getPlayerFromName(r) then
local receiver=getPlayerName(r)
local x,y,z=getElementPosition(r)
local adminName=getPlayerName(plr)
if (verify()==true) then
spawnPlayer(plr,x,y,z)
outputChatBox('You Have Been Teleported To '..receiver,plr)
outputChatBox('Admin '.. adminName..'Have Been Teleported To You ',r)
else
outputChatBox('YOU ARE NOT ALLOWED TO USE THIS COMMAND',plr)

end
end
addCommandHandler('teleport',teleport)


 

Link to comment
1 hour ago, DiGiTal said:

function verify()
local players = getElementsByType ( "player" )
for k,v in ipairs(players) do
   local accountname = ""
   if (isGuestAccount(getPlayerAccount(v)) == false) then
      accountname = getAccountName (getPlayerAccount(v))
 
if isObjectInACLGroup("user." .. accountname, aclGetGroup ( "Admin" )) then
return true else return false
end
end
end
end

function teleport(plr,cmd,r)
if getPlayerFromName(r) then
local receiver=getPlayerName(r)
local x,y,z=getElementPosition(r)
local adminName=getPlayerName(plr)
if (verify()==true) then
spawnPlayer(plr,x,y,z)
outputChatBox('You Have Been Teleported To '..receiver,plr)
outputChatBox('Admin '.. adminName..'Have Been Teleported To You ',r)
else
outputChatBox('YOU ARE NOT ALLOWED TO USE THIS COMMAND',plr)

end
end
addCommandHandler('teleport',teleport)


 

it did not work

Link to comment

This is a very easy script, you really shouldn't have any issues writing this yourself.

Quote

@Galactix You can give me a script ?

Seriously? You ask him to give you a script every time? How about you read the rules of this forum section? We're not here to give scripts, but to give advice and help resolving issues which you come across.

function tpCommand(plr, cmd, target)
  local trgt = Player.getFromName(target)
  if not isElement(trgt) then -- if target player was NOT found from the name
    plr:outputChat("No player named "..target.." found.")
    return
  end
  local acc = plr.account
  if acc.guest or (not ACLGroup.get("Admin"):doesContainObject("user."..acc.name)) then -- if its a guest account or doesn't exist in Admin acl group
    plr:outputChat("You do not have permission to use this command.")
    return -- abort the function here
  end
  plr.position = trgt.position -- set your position to their position
  plr:outputChat("Teleported to "..trgt.name..".")
  trgt:outputChat("Admin "..plr.name.." has teleported to you.")
end
addCommandHandler("teleport", tpCommand)

This code requires you to set <oop>true</oop> in meta.xml. If you don't want to use OOP, you're gonna have to try to convert this code to non-OOP yourself, as a little learning exercise.

Edited by MrTasty
Link to comment
  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...