Jump to content

dxDraw


Recommended Posts

I want the dxdraw to only show to the player who entered the marker not to all

sx,sy = guiGetScreenSize() 
local marker = createMarker ( 0,0,2, "cylinder", 1, 0,255,255,155 ) 
  
function gui () 
    dxDrawRectangle ((sx/2)-50,(sy/2)-50,100,100, tocolor (0,0,0,155), false) 
addEventHandler ( "onClientRender", getRootElement(), gui ) 
end 
addEventHandler ( "onClientMarkerHit", marker, gui ) 
  

Link to comment
sx,sy = guiGetScreenSize() 
local marker = createMarker ( 0,0,2, "cylinder", 1, 0,255,255,155 ) 
  
function gui (      ) 
    dxDrawRectangle ((sx/2)-50,(sy/2)-50,100,100, tocolor (0,0,0,155), false) 
end 
  
function aShowDx ( player ) 
    if player == localPlayer then 
        addEventHandler ( "onClientRender", getRootElement(), gui ) 
    end 
end 
addEventHandler ( "onClientMarkerHit", marker, aShowDx,false ) 
  
function aDestroyDx ( player ) 
    if player == localPlayer then 
        removeEventHandler ( "onClientRender", getRootElement(), gui ) 
    end 
end 
addEventHandler ( "onClientMarkerLeave", marker, aDestroyDx,false ) 

Not tested.

Edited by Guest
Link to comment

thanks it works now

EDIT: there was a mistake in your script, heres the working one:

sx,sy = guiGetScreenSize() 
local marker = createMarker ( 0,0,2, "cylinder", 1, 0,255,255,155 ) 
  
function gui (      ) 
    dxDrawRectangle ((sx/2)-50,(sy/2)-50,100,100, tocolor (0,0,0,155), false) 
end 
  
function aShowDx ( player ) 
    if player == localPlayer then 
        addEventHandler ( "onClientRender", getRootElement(), gui ) 
    end 
end 
addEventHandler ( "onClientMarkerHit", marker, aShowDx,false ) 
  
function aDestroyDx ( player ) 
    if player == localPlayer then 
        removeEventHandler ( "onClientRender", getRootElement(), gui ) 
    end 
end 
addEventHandler ( "onClientMarkerLeave", marker, aDestroyDx,false ) 
  

Edited by Guest
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...