Jump to content

[HELP]Inside vehicle, don't open marker


HeK

Recommended Posts

Posted

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 
) 

Zero is a number too.

Posted

Post the code where you hit the marker.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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 

Zero is a number too.

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

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

One more thing, when players disconnect the vehicles stay in game, is there any way to fix that?

Zero is a number too.

Posted
addEventHandler ( "onPlayerQuit", root, 
    function ( ) 
        if ( isElement ( vehicles [ source ] ) ) then 
            destroyElement ( vehicles [ source ] ) 
        end 
    end 
) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Is a server side script.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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