Jump to content

On marker hit nothing happens :/


igthomas

Recommended Posts

Here's a scripts that I've done but the problem is that markers show up but nothing happens :/ Could someone please explain my fault?

function rvb() 
    marker_red = createMarker(-840.5, 502, 1357.1999511719, "cylinder", 3 , 255, 0, 0, 255 ) 
        setElementInterior ( marker_red, 1) 
    marker_blue = createMarker(-840.5, 495.60000610352, 1357.1999511719, "cylinder", 3, 0, 0, 255, 255 ) 
    setElementInterior ( marker_blue, 1) 
     
end 
addEventHandler ("onResourceStart",resourceRoot,rvb) 
  
function rvbstart(thePlayer, hitElement) 
    if source == marker_red then 
    setElementPosition ( thePlayer, 697.5, -2677.8000488281, 8.8000001907349, true ) 
    setElementInterior ( thePlayer, 0) 
    elseif source == marker_blue then 
    setElementPosition ( thePlayer, 534.70001220703, -2694.1000976563, 8.8000001907349, true ) 
    setElementInterior ( thePlayer, 0) 
    end 
end 
addEventHandler ("onMarkerHit",getRootElement(),rvbstart) 

Link to comment

Try this debug.

  
local marker_red = createMarker(-840.5, 502, 1357.1999511719, "cylinder", 3 , 255, 0, 0, 255 ) 
setElementInterior ( marker_red, 1 ) 
local marker_blue = createMarker(-840.5, 495.60000610352, 1357.1999511719, "cylinder", 3, 0, 0, 255, 255 ) 
setElementInterior ( marker_blue, 1 ) 
outputChatBox 'Debug:markers'  
  
function rvbstart( thePlayer, hitElement ) 
    outputChatBox 'Debug:hit'  
    if source == marker_red then 
        setElementPosition ( thePlayer, 697.5, -2677.8000488281, 8.8000001907349, true ) 
        setElementInterior ( thePlayer, 0 ) 
        outputChatBox 'Debug:warped --> marker_red'  
    elseif source == marker_blue then 
        setElementPosition ( thePlayer, 534.70001220703, -2694.1000976563, 8.8000001907349, true ) 
        setElementInterior ( thePlayer, 0 ) 
        outputChatBox 'Debug:warped --> marker_blue'  
    end 
end 
addEventHandler ( "onMarkerHit",root,rvbstart ) 

Link to comment

Tried and same problem :/

local marker_red = createMarker(-840.5, 502, 1357.1999511719, "cylinder", 3 , 255, 0, 0, 255 ) 
setElementInterior ( marker_red, 1 ) 
local marker_blue = createMarker(-840.5, 495.60000610352, 1357.1999511719, "cylinder", 3, 0, 0, 255, 255 ) 
setElementInterior ( marker_blue, 1 ) 
  
function redstart( thePlayer, hitElement ) 
    if source == marker_red then 
        setElementPosition ( thePlayer, 697.5, -2677.8000488281, 8.8000001907349, true ) 
        setElementInterior ( thePlayer, 0 ) 
    end 
end 
addEventHandler ( "onMarkerHit",marker_red,redstart ) 
  
  
function bluestart( thePlayer, hitElement ) 
    if source == marker_blue then 
        setElementPosition ( thePlayer, 534.70001220703, -2694.1000976563, 8.8000001907349, true ) 
        setElementInterior ( thePlayer, 0 ) 
    end 
end 
addEventHandler ( "onMarkerHit",marker_blue,bluestart ) 

Link to comment

As another option to marker higher.

Just add to the axis of z + 1 and check again.

If the marker below the player's position, the event will not be called.

  
local marker_red = createMarker(-840.5, 502, 1358.1999511719, "cylinder", 3 , 255, 0, 0, 255 ) 
setElementInterior ( marker_red, 1 ) 
local marker_blue = createMarker(-840.5, 495.60000610352, 1358.1999511719, "cylinder", 3, 0, 0, 255, 255 ) 
setElementInterior ( marker_blue, 1 ) 
outputChatBox 'Debug:markers'  
  
function rvbstart( thePlayer, hitElement ) 
    outputChatBox 'Debug:hit'  
    if source == marker_red then 
        setElementPosition ( thePlayer, 697.5, -2677.8000488281, 8.8000001907349, true ) 
        setElementInterior ( thePlayer, 0 ) 
        outputChatBox 'Debug:warped --> marker_red'  
    elseif source == marker_blue then 
        setElementPosition ( thePlayer, 534.70001220703, -2694.1000976563, 8.8000001907349, true ) 
        setElementInterior ( thePlayer, 0 ) 
        outputChatBox 'Debug:warped --> marker_blue'  
    end 
end 
addEventHandler ( "onMarkerHit",root,rvbstart ) 

Link to comment
  

     "SantaB" type="script" name="RvB" description="RvB" /> 
     

Not sure, but afaik you should specify if it's server-side or client-side, then it must be like this:

  

     "SantaB" type="script" name="RvB" description="RvB" /> 
     

It's server-side. You don't need to specify the type ( if you don't specify then it will be server-side type ).

Link to comment

haha Guys it worked the problem was that yesterday I was testing it with editor (Full Test) so it didn't warp me but today I've started play(resource) and tried the marker and it warped me :D anyways thanks guys to be so cool and helping me, I really appreciated your helps

oh and last problem why do I get this error in console : WARNING: (SantaB)RvB\teleports.lua:10: Bad 'team' pointer @ 'setTeamColor'(1)

local marker_red = createMarker(-840.5, 502, 1357.3, "cylinder", 3 , 255, 0, 0, 255 ) 
setElementInterior ( marker_red, 1 ) 
local marker_blue = createMarker(-840.5, 495.60000610352, 1357.3, "cylinder", 3, 0, 0, 255, 255 ) 
setElementInterior ( marker_blue, 1 ) 
  
function rvbstart( thePlayer, hitElement ) 
    outputChatBox 'Debug:hit' 
    if source == marker_red then  
          setTeamColor ( thePlayer, 255, 0, 0 )  
            setElementPosition ( thePlayer, 697.5, -2677.8000488281, 8.8000001907349, true ) 
            setElementInterior ( thePlayer, 0 ) 
          setElementDimension ( thePlayer, 10 ) 
    elseif source == marker_blue then 
        setTeamColor ( thePlayer, 0, 0, 255 )  
        setElementPosition ( thePlayer, 534.70001220703, -2694.1000976563, 8.8000001907349, true ) 
        setElementInterior ( thePlayer, 0 ) 
        setElementDimension ( thePlayer, 10 ) 
  end 
end 
addEventHandler ( "onMarkerHit",root,rvbstart ) 

Link to comment
haha Guys it worked the problem was that yesterday I was testing it with editor (Full Test) so it didn't warp me but today I've started play(resource) and tried the marker and it warped me :D anyways thanks guys to be so cool and helping me, I really appreciated your helps

oh and last problem why do I get this error in console : WARNING: (SantaB)RvB\teleports.lua:10: Bad 'team' pointer @ 'setTeamColor'(1)

local marker_red = createMarker(-840.5, 502, 1357.3, "cylinder", 3 , 255, 0, 0, 255 ) 
setElementInterior ( marker_red, 1 ) 
local marker_blue = createMarker(-840.5, 495.60000610352, 1357.3, "cylinder", 3, 0, 0, 255, 255 ) 
setElementInterior ( marker_blue, 1 ) 
  
function rvbstart( thePlayer, hitElement ) 
    outputChatBox 'Debug:hit' 
    if source == marker_red then  
          setTeamColor ( thePlayer, 255, 0, 0 )  
            setElementPosition ( thePlayer, 697.5, -2677.8000488281, 8.8000001907349, true ) 
            setElementInterior ( thePlayer, 0 ) 
          setElementDimension ( thePlayer, 10 ) 
    elseif source == marker_blue then 
        setTeamColor ( thePlayer, 0, 0, 255 )  
        setElementPosition ( thePlayer, 534.70001220703, -2694.1000976563, 8.8000001907349, true ) 
        setElementInterior ( thePlayer, 0 ) 
        setElementDimension ( thePlayer, 10 ) 
  end 
end 
addEventHandler ( "onMarkerHit",root,rvbstart ) 

setTeamColor first argument isn't player element, but the team variable.

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