Jump to content

How to change?


DarkByte

Recommended Posts

  • Moderators

So KariiiM was right but no one here could tell for sure that you wanted a crosshair instead of the corona.

corona = createMarker (0, 0, -10, "corona", 1.0, 0, 100, 0, 150) 

Can you show us the entire function so we know where we have to work in ?

Link to comment

Hey i scripted this part for you, maybe that's what you need as i understood

-Client side

addEventHandler("onClientVehicleEnter", getRootElement(), 
    function(thePlayer, seat) 
      local tank = {[432]=true} 
      local theVehicle = getPedOccupiedVehicle(localPlayer) 
      if (not theVehicle) then return end 
      local model = getElementModel(theVehicle) 
      if ( thePlayer == localPlayer) then  
      if ( tank[model] ) then   
      addEventHandler("onClientRender", getRootElement(),dxDraw) 
      end 
    end 
end) 
  
function dxDraw() 
dxDrawImage (sx,sy,sx,sy,"yourImage.png") --draw your image 
end 

Edited by Guest
Link to comment

Its working now, i changed something and i fixed some warnings

local sx, sy = guiGetScreenSize() 
function createImage() 
dxDrawImage((sx-68)/ 2, (sy-54)/2, 68, 54, "yourCrossHair.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)  
end 
addEventHandler("onClientVehicleEnter", getRootElement(), 
    function () 
      local player = getLocalPlayer() 
      local theVehicle = getPedOccupiedVehicle( player ) 
      if ( getElementType ( theVehicle ) == 'vehicle' and isPedInVehicle ( player ) and getElementModel ( theVehicle ) == 432 ) then 
      if (theVehicle) then 
      addEventHandler ( "onClientRender", root, createImage ) 
      end 
    end 
end) 

Link to comment
I need to draw crosshair at the end of the turret, not in middle of screen

Do it by yourself? and get your own Resolution,

Here's full code i cleaned and added something

local sx, sy = guiGetScreenSize() 
function createImage() 
dxDrawImage((sx - 68) / 2, (sy - 54) / 2, 68, 54, "yourcrosshair.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) 
end 
addEventHandler("onClientVehicleEnter", getRootElement(), 
    function (player, seat) 
      local theVehicle = getPedOccupiedVehicle( player ) 
      if ( player == getLocalPlayer() and getElementType ( theVehicle ) == 'vehicle' and isPedInVehicle ( player ) and getElementModel ( theVehicle ) == 432 ) then 
      if (theVehicle) then 
      addEventHandler ( "onClientRender", root, createImage ) 
      end 
    end 
end) 
  
function destroyImage(player, seat) 
      if ( player == getLocalPlayer() and getElementType ( theVehicle ) == 'vehicle' and not isPedInVehicle ( player ) and getElementModel ( theVehicle ) == 432 ) then 
      removeEventHandler ( "onClientRender", root, createImage ) 
   end 
end 
addEventHandler("onClientVehicleExit", getRootElement(),destroyImage) 

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