Jump to content

problem with markers and Event


Destroyer.-

Recommended Posts

Hi, I have a problem with markers when the marker passes the timer and leave out, to avoid passing through the sky, the program goes but I strip warning on this line

   addEventHandler( "onClientMarkerHit", segundo, segundogolpe ) 

argument 2 got nil

  
function getNewLocation ( player, seat ) 
progreso = 0 
    local vehicle = getPedOccupiedVehicle ( player ) 
    local id = getElementModel ( vehicle ) 
    if (getElementModel(vehicle) == 519 ) and ( progreso == 0 ) then 
    if (player == localPlayer) then 
inicial =  createMarker(-1674.396484375,-181.70758056641,13.1484375, "checkpoint", 4, 255, 255, 0, 150) 
blip = createBlipAttachedTo ( inicial, 41 ) 
progreso = 1 
  
  
    addEventHandler( "onClientMarkerHit", inicial,      
            function ( hitElement ) 
            vehiculo = getPedOccupiedVehicle (hitElement) 
            if not vehiculo then return end   
                if ( hitElement and getElementType ( hitElement ) == "player" and hitElement == localPlayer and getElementModel(vehiculo) == 519 ) then 
                theTime[hitElement] = setTimer(function () 
                    destroyElement ( inicial ) 
                    destroyElement ( blip ) 
                    segundo = createMarker(1935.3822021484,-2550.5134277344,13.546875, "checkpoint", 4, 255, 255, 0, 150) 
blip2 = createBlipAttachedTo ( segundo, 41 ) 
   setElementData(segundo,"pilotomarker",true) 
   end,3000,1, true) 
    
    
   addEventHandler( "onClientMarkerHit", segundo, segundogolpe ) 
                    
                end 
            end 
         
            ) 
     
            addEventHandler( "onClientMarkerLeave", inicial,  
                   
            function ( hitElement ) 
    if isTimer(theTime[hitElement]) and isElement(inicial) then 
    killTimer(theTime[hitElement]) 
            end 
        end 
            ) 
             
  
end 
end 
end 
addEventHandler ( "onClientVehicleEnter", root, getNewLocation) 
  
  
function segundogolpe(hitElement, matchingDimension) 
local vehiculo = getPedOccupiedVehicle (hitElement) 
if hitElement == localPlayer and getElementModel(vehiculo) == 519  then 
for i,v in ipairs (getElementsByType("marker") ) do 
if getElementData(v,"pilotomarker") == true then 
setElementData(hitElement,"puedepiloto",1) 
destroyElement(v) 
end 
end 
triggerServerEvent("pilotoevent",localPlayer,"pagaPiloto") 
destroyElement(blip2) 
progreso = 0 
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...