Jump to content

Problem with a thing.


villr

Recommended Posts

What's the problem with this code?

It dont wanna start when i added that you'll see where

marker = createMarker(-1356.8,-260.0,15.6, "arrow", 2,255, 255,0) 
marker2 = createMarker(2.67,32.97,1201, "arrow", 2,255,255,0) 
marker1 = createMarker(-1356.8,-260.0,15.6,"arrow",2,255,255,0) 
marker3 = createMarker(2.67,32.97,1201, "arrow", 2,255,255,0) 
setElementInterior(marker2,1) 
veh = createVehicle(519,-1130.24,-405.96,16,0,0,90) 
veh1 = createVehicle(409,394.2,2603.26,51.0,0,0,10) 
setVehicleColor(veh1,0,0,0,0) 
setElementInterior(marker2,1) 
  
  
setTimer(function() local x,y,z = getElementPosition(veh) setElementPosition(marker,x-4,y+2,z+1,100)  
setTimer(function() local x,y,z = getElementPosition(veh1) setElementPosition(marker2,x-4,y+2,z+1,100)   -- when i add this the script stops to work idk why? 
setElementInterior(marker, 0)end,1000,0) 
  
function customInt(thePlayer) 
    if source ~= marker then return end 
if getElementType(thePlayer) == "vehicle" or getPedOccupiedVehicle(thePlayer) then return end 
    local x,y,z = getElementPosition(marker2) 
    setElementPosition(thePlayer,x,y,z) 
    setElementInterior(thePlayer,getElementInterior(marker2)) 
end 
addEventHandler( "onMarkerHit",getRootElement(),customInt) 
  
  
function customInt(thePlayer) 
    if source ~= marker2 then return end 
if getElementType(thePlayer) == "vehicle" or getPedOccupiedVehicle(thePlayer) then return end 
    local x,y,z = getElementPosition(marker) 
    setElementPosition(thePlayer,x,y,z) 
    setElementInterior(thePlayer,getElementInterior(marker)) 
    end 
addEventHandler( "onMarkerHit",getRootElement(),customInt) 

Link to comment

because you're messing up the whole syntax by simply copying a line. the function is inside setTimer (whis is not closed on the same line).

here's how it should be (assuming you want something done in the same timer), with line breaks:

setTimer(function()  
  local x,y,z = getElementPosition(veh)  
  setElementPosition(marker,x-4,y+2,z+1,100) 
  x,y,z = getElementPosition(veh1)  
  setElementPosition(marker2,x-4,y+2,z+1,100)  
  setElementInterior(marker, 0) 
end,1000,0) 
  

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