Jump to content

How create blip visible only near player?


Guest aseffect

Recommended Posts

Morning, I want to create blip attached to vehicle, but I want that this blip will visible only when player near this car (or in сertain distance between him and car) How can I do it? :(

Link to comment

         
px,py,pz = getElementPosition( getLocalPlayer() ) 
vehicles = getElementsByType ( "vehicle" ) 
  
        for vehicleKey, vehicleValue in ipairs(vehicles) do   
             
            carx,cary,carz = getElementPosition( vehicleValue ) 
             
            pcDist = getDistanceBetweenPoints2D ( px, py, carx, cary ) 
             
            if pcDist <= 200 then 
            blip = createBlipAttachedTo ( vehicleValue, 0, 0.6, 200, 0, 0 ) 
            end 
        end 
  
  

This is part of a larger client side script and does it for ALL cars, so you'd have to modify it. Hope it points you in the right direction.

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