Jump to content

markers


CapY

Recommended Posts

  • Replies 73
  • Created
  • Last Reply

Top Posters In This Topic

Are you serious??

Have you met the WIKI yet?

Don't just come asking for help, put some effort in trying to achieve what you want.

Then come ask for help you with your trial.

use: onMarkerHit event

functions:

createMarker 
setElementPosition 
fadeCamera -- for fading to black before teleporting. 

Link to comment
local sMarker = createMarker (1618.6726074219, 1448.3284912109, 30.770175933838, 'cylinder', 7.0, 255, 0, 0, 150) -- create myMarker 
  
function MarkerHit( hitElement, matchingDimension ) -- define MarkerHit function for the handler 
    local elementType = getElementType( hitElement ) -- get the hit element's type 
    outputChatBox( elementType.." inside sMarker", getRootElement(), 255, 255, 0 ) -- attach the element's type with the text, and output it 
    setElementPosition ( getLocalPlayer(), 1618.6726074219, 1448.3284912109, 30.770175933838 ) 
end 
addEventHandler( "onMarkerHit", sMarker, MarkerHit ) 
  
  

meta :

    type="map" version="1.0.0" /> 
    "beachparty.map" dimension="0" /> 
    "1618.6726074219" posY="1448.3284912109" posZ="30.770175933838" type="cylinder" />  
    

Nil at

getLocalPlayer() 

Link to comment

type = script ? o_O

You don't know what you are doing, that script contains both server and client.

local sMarker = createMarker (1618.6726074219, 1448.3284912109, 30.770175933838, 'cylinder', 7.0, 255, 0, 0, 150) -- create myMarker 
  
function MarkerHit( hitElement, matchingDimension ) -- define MarkerHit function for the handler 
    local elementType = getElementType( hitElement ) -- get the hit element's type 
    outputChatBox( elementType.." inside sMarker", getRootElement(), 255, 255, 0 ) -- attach the element's type with the text, and output it 
    setElementPosition ( hitElement, 1618.6726074219, 1448.3284912109, 30.770175933838 ) 
end 
addEventHandler( "onMarkerHit", sMarker, MarkerHit ) 

WTF a marker doing in the meta.xml

<meta> 
    <info type="map" version="1.0.0" /> 
    <map src="beachparty.map" dimension="0" /> 
    <script src="markerS.lua" type="server" /> 
</meta> 

Link to comment

You can make it client side, but, needs edit, message will only appear for hitElement, onClientMarkerHit not onMarkerHit,

local sMarker = createMarker (1618.6726074219, 1448.3284912109, 30.770175933838, 'cylinder', 7.0, 255, 0, 0, 150) -- create myMarker 
  
function MarkerHit( hitElement, matchingDimension ) -- define MarkerHit function for the handler 
    local elementType = getElementType( hitElement ) -- get the hit element's type 
    outputChatBox( elementType.." inside sMarker", 255, 255, 0 ) -- attach the element's type with the text, and output it 
    setElementPosition ( hitElement, 1618.6726074219, 1448.3284912109, 30.770175933838 ) 
end 
addEventHandler( "onClientMarkerHit", sMarker, MarkerHit ) 

Link to comment
  • 2 weeks later...

Why nil on getLocalPlayer() ?

Here :

local sMarker = createMarker (-1921.900, 536.816, 267.400, 'cylinder', 3.0, 255, 0, 0, 0) -- create myMarker 
  
function MarkerHit( hitElement, matchingDimension ) -- define MarkerHit function for the handler 
    local elementType = getElementType( hitElement ) -- get the hit element's type 
    setElementPosition ( getLocalPlayer(), 1618.6726074219, 1448.3284912109, 30.770175933838 ) 
end 
addEventHandler( "onMarkerHit", sMarker, MarkerHit ) 

Link to comment

Doesnt works ..

local sX, sY = guiGetScreenSize() 
local x,y= getScreenFromWorldPosition ( posX,posY,posZ ) 
  
addEventHandler("onClientRender", root, 
    function() 
        local px, py, pz = getElementPosition(getLocalPlayer()) 
            local x, y = getScreenFromWorldPosition(-1921.900, 536.816, 32.340) 
            if x and y then 
                dxDrawText("LV", -1921.900, 536.816, 32.340,380.0,tocolor(255,255,255,255),2.0,"default","left","top",false,false,false) 
            end 
        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...