Jump to content

Warp/Teleport accept


Ralf122

Recommended Posts

We do not make scripts for you, but we can give you a helping hand.

Here are some functions you need.

If your try is not working, show it to us.

addEventHandler -- Event handler 
createMarker -- The marker 
outputChatBox -- For to show you the messages when you open/close the marker 
addCommandHandler -- Open/close command 
setElementPosition -- Set the player's position 
setElementInterior -- To change the interior of the player 
setElementDimension -- To change the dimension of the player 
destroyElement -- To destroy the marker on the close command 

Link to comment

u meaning this?:

-- serverside

function hit ( player ) 
setElementPosition ( player, x, y, z ) -- put your'e own position in it 
setElementDimension ( player, dimensionidhere ) -- dimensionid here 
setElementInterior ( player, intID ) -- interior id here 
end 
  
function open () 
local marker = createMarker ( x, y, z )  -- put your'e own position in it where you wanna have the marker 
outputChatBox ( "The deathmatch arena is open!" ) 
addEventHandler ( "onMarkerHit", marker, hit ) 
end 
addCommandHandler ( "opendeatmatch", open ) 
  
function close () 
outputChatBox ( "The deathmatch arena is closed!" ) 
destroyElement ( marker ) 
end 
addCommandHandler ( "closedeatmatch", close ) 
  
  

Link to comment
u meaning this?:

-- serverside

function hit ( player ) 
setElementPosition ( player, x, y, z ) -- put your'e own position in it 
setElementDimension ( player, dimensionidhere ) -- dimensionid here 
setElementInterior ( player, intID ) -- interior id here 
end 
  
function open () 
local marker = createMarker ( x, y, z )  -- put your'e own position in it where you wanna have the marker 
outputChatBox ( "The deathmatch arena is open!" ) 
addEventHandler ( "onMarkerHit", marker, hit ) 
end 
addCommandHandler ( "opendeatmatch", open ) 
  
function close () 
outputChatBox ( "The deathmatch arena is closed!" ) 
destroyElement ( marker ) 
end 
addCommandHandler ( "closedeatmatch", close ) 
  
  

that's completely non-related

Link to comment

i made something i think it's not very well.

function goToplayer(source) 
        local x,y,z = getElementPosition(cH) 
        setElementPosition(source, x, y, z + 15) 
    --end 
end 
addCommandHandler("warpto", goToPlayer) 

i didn't know how to make the accept part.

Link to comment
  
function warp( player, command, who ) 
    local target = getPlayerFromName ( who )                 
    if ( target ) then                                       
local x,y,z = getElementPosition ( target ) 
setElementPosition( player, x, y, z ) 
end 
end 
addCommandHandler ( "warp", warp ) 
  
  

Link to comment
Well if the player wants to warp a person /warpto, then something in the chat or a little gui has to appear where the person can accept or decline the warp command.

I think that's stupid. Why would the player use /warpto if (s)he doesn't want to warp?

Link to comment
local invitations = {} 
  
addCommandHandler("warpto", 
function (thePlayer, cmd, who) 
    if (not who or who == "") then outputChatBox("/"..cmd..": No player inserted.",thePlayer,255,0,0) return end 
    local player = getPlayerFromName(who) 
    if (not player) then outputChatBox("/"..cmd..": This player does not exists.",thePlayer,255,0,0) return end 
    if (invitations[thePlayer]) then outputChatBox("/"..cmd..": You already sent a warp invitation.",thePlayer,255,0,0) return end 
    outputChatBox(getPlayerName(player) .." want's to warp to you, write /accept ".. getPlayerName(thePlayer) ..".",player,0,255,0) 
    outputChatBox("You have sent a warp invitation to ".. getPlayerName(player) ..".",player,0,255,0) 
    invitations[thePlayer] = player 
    setTimer(function () invitations[thePlayer] = nil end, 60000, 1) 
end) 
  
addCommandHandler("accept", 
function (thePlayer, cmd, who) 
    if (not who or who == "") then outputChatBox("/"..cmd..": No player inserted.",thePlayer,255,0,0) return end 
    local player = getPlayerFromName(who) 
    if (not player) then outputChatBox("/"..cmd..": This player does not exists.",thePlayer,255,0,0) return end 
    if invitations[player] then 
        setElementPosition(player, getElementPosition(thePlayer)) 
        outputChatBox("You have accepted ".. getPlayerName(player) .."'s warp invitation.",thePlayer,0,255,0) 
        outputChatBox(getPlayerName(thePlayer) .. " accepted your warp invitation.",player,0,255,0) 
        invitations[player] = nil 
    end 
end) 

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