Jump to content

Teleports


Timiimit

Recommended Posts

Hi!

I have started to make some teleports for admins, moderators and super moderators only. i want to make commandHandler (showadminmarker) and then if you are admin, it create marker and after 3 seconds it dessapears! if you touch it (when visible) it should teleport you!

this is what I have:

  
function consoleShowMarker ( thePlayer, commandName ) 
   if ( thePlayer ) then 
      local x, y, z = getElementPosition ( thePlayer ) 
      local theMarker = createMarker ( some X, some Y, some Z, "cylinder", 1.5, 255, 0, 0, 170 ) 
      if ( theMarker ) then 
  
    setTimer ( consoleUnshowMarker, 3000, 1 ) 
      end 
   end 
end 
  
function consoleUnshowMarker () 
destroyElement ( theMarker ) 
end 
addCommandHandler ( "showAdminMarker", consoleShowMarker ) 
  

how to continue?

Link to comment
function consoleShowMarker ( thePlayer, commandName ) 
   if ( thePlayer ) then 
      local x, y, z = getElementPosition ( thePlayer ) 
      local theMarker = createMarker ( some X, some Y, some Z, "cylinder", 1.5, 255, 0, 0, 170 ) 
      if ( theMarker ) then 
  
    setTimer (destroyElement, 3000, 1, theMarker ) 
      end 
   end 
end 
addCommandHandler ( "showAdminMarker", consoleShowMarker ) 

Link to comment
function consoleShowMarker ( thePlayer, commandName ) 
   if ( thePlayer ) then 
      local x, y, z = getElementPosition ( thePlayer ) 
      local theMarker = createMarker (x,y, z, "cylinder", 1.5, 255, 0, 0, 170 ) 
      if ( theMarker ) then 
  
    setTimer (destroyElement, 3000, 1, theMarker ) 
      end 
   end 
end 
addCommandHandler ( "showAdminMarker", consoleShowMarker ) 

Link to comment

Ok!??

this is what I have:

  
function consoleShowMarker ( thePlayer, commandName ) 
   if ( thePlayer ) then 
     local theMarker = createMarker (X, Y, Z, "cylinder", 1.5, 255, 0, 0, 170 ) 
      if ( theMarker ) then 
    setTimer (destroyElement, 3000, 1, theMarker ) 
      end 
   end 
end 
  
function teleportPlayerIfModSmodOrAdmin ( thePlayer ) 
    if hasObjectPermissionTo ( player, "command.kick", false ) then 
        setElementPosition ( thePlayer,X, Y,Z ) 
    end 
end 
  
addCommandHandler ( "showadminmarker", consoleShowMarker ) 
addEventHandler( "onMarkerHit", theMarker, MarkerHit ) 
  

it doesn't work but if I put global not local, it works even less.

HELP!

Link to comment
function consoleShowMarker ( thePlayer, commandName ) 
   if ( thePlayer ) then 
     local theMarker = createMarker (X, Y, Z, "cylinder", 1.5, 255, 0, 0, 170 ) 
      if ( theMarker ) then 
    setTimer (destroyElement, 3000, 1, theMarker ) 
addEventHandler( "onMarkerHit", theMarker, MarkerHit ) 
      end 
   end 
end 
  
function teleportPlayerIfModSmodOrAdmin ( thePlayer ) 
    if hasObjectPermissionTo ( player, "command.kick", false ) then 
        setElementPosition ( thePlayer,X, Y,Z ) 
    end 
end 
  
addCommandHandler ( "showadminmarker", consoleShowMarker ) 
  

Put the onMarkerHit inside the function with the marker in it.

PS - There is no function called markerHit in your script, so that addEventHandler wont work. You only have functions called consoleShowMarker and teleportPlayerIfModSmodOrAdmin in your script.

Link to comment

still doesn't work...??

log:

when server starts

  
[2011-12-27 10:33:43] SCRIPT ERROR: myscripts\adminTeleport.lua:3: '=' expected near 'theMarker' 
[2011-12-27 10:33:43] WARNING: Loading script failed: myscripts\adminTeleport.lua:3: '=' expected near 'theMarker' 
  

when command entered.

  
WARNING: myscripts\adminTeleport.lua:6: Bad argument @ 'addEventHandler' [Expected function at argument 3, got nil] 
  

Link to comment

for the marker, what's the coordinate for where you want to place the marker?

function consoleShowMarker ( thePlayer, commandName ) 
   if ( thePlayer ) then 
     local theMarker = createMarker (X, Y, Z, "cylinder", 1.5, 255, 0, 0, 170 ) 
      if ( theMarker ) then 
      addEventHandler( "onMarkerHit", theMarker, teleportPlayerIfModSmodOrAdmin ) 
    setTimer (destroyElement, 3000, 1, theMarker ) 
      end 
   end 
end 
  
function teleportPlayerIfModSmodOrAdmin ( thePlayer ) 
    if hasObjectPermissionTo ( player, "command.kick", false ) then 
        setElementPosition ( thePlayer,X, Y,Z ) 
    end 
end 
  
addCommandHandler ( "showadminmarker", consoleShowMarker ) 

you didn't attached the function for when an admin goes in the marker

Edited by Guest
Link to comment

script:

  
function consoleShowMarker ( thePlayer, commandName ) 
   if ( thePlayer ) then 
     local theMarker = createMarker (x,y,z, "cylinder", 1.5, 255, 0, 0, 170 ) 
      if ( theMarker ) then 
     addEventHandler( "onMarkerHit", theMarker, teleportPlayerIfModSmodOrAdmin ) 
    setTimer (destroyElement, 3000, 1, theMarker ) 
      end 
   end 
end 
  
function teleportPlayerIfModSmodOrAdmin ( thePlayer ) 
    if hasObjectPermissionTo ( thePlayer, "command.kick", false ) then 
        setElementPosition ( thePlayer, x,y,z ) 
    end 
end 
  
addCommandHandler ( "showadminmarker", consoleShowMarker ) 
  

works!!!!!

:D

finally!

thx for all.

Link to comment

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...