Jump to content

[HELP]Inside vehicle, don't open marker


HeK

Recommended Posts

I have been trying some stuff but none worked, i need to check if the player is in a vehicle and when he touches the marker, it shouldn't open the GUI.

local vehicles = { } 
  
addEvent ( "spawnvehicle", true ) 
addEventHandler ( "spawnvehicle", root, 
    function ( vehID ) 
     if ( isElement ( vehicles [ source ] ) ) then 
            destroyElement ( vehicles [ source ] ) 
        end  
     vehicles [ source ] = createVehicle ( vehID, getElementPosition ( source ) ) 
        if ( vehicles [ source ] ) then 
            setVehicleColor ( vehicles [ source ], 240, 240, 240 ) 
        end 
      setTimer ( warpPedIntoVehicle, 200, 1, source, vehicles [ source ] ) 
        triggerClientEvent ( source, "closeWindow", root ) 
end 
) 

Link to comment
addEventHandler ( "onClientMarkerHit", marker, 
    function ( hitElement ) 
        if ( hitElement == localPlayer ) then 
                createVehGui ( hitElement ) 
                if ( MainGui ~= nil ) then 
                    guiSetVisible ( MainGui, true ) 
                    showCursor ( true ) 
                    guiSetInputEnabled ( true ) 
                    setElementFrozen ( hitElement, true ) 
                end 
        end 
    end 

Link to comment
addEventHandler ( "onClientMarkerHit", marker, 
    function ( hitElement ) 
        if ( hitElement == localPlayer ) then 
            if ( getElementType ( hitElement ) == "player" and not isPedInVehicle ( hitElement ) ) then 
                createVehGui ( hitElement ) 
                if ( MainGui ~= nil ) then 
                    guiSetVisible ( MainGui, true ) 
                    showCursor ( true ) 
                    guiSetInputEnabled ( true ) 
                    setElementFrozen ( hitElement, true ) 
                end 
            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...