Jump to content

markers


CapY

Recommended Posts

  • Replies 73
  • Created
  • Last Reply

Top Posters In This Topic

Posted

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. 

Posted

That's why I made a comment beside so you CAN read it.

For fading to black before warping, and fading in again.

It's used a lot with warping so though of adding it.

Posted
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() 

Posted

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> 

Posted

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 ) 

  • 2 weeks later...
Posted

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 ) 

Posted

Because, it's SERVER sided, and you are using getLocalPlayer()

use onClientMarkerHit, or use it server side, and use hitElement.

Posted
    local x,y= getScreenFromWorldPosition ( posX,posY,posZ ) 
dxDrawText ( "text", x, y , ...) 

And onClientRender.

Posted

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 
) 
  
  

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