Jump to content

How to change?


DarkByte

Recommended Posts

Posted (edited)
TO remove CORONA and change to image.

Yes i understand this part, but what's the role of this image? moving or doing what also what's position of it you want it to take the crosshair place or at where

Edited by Guest
  • Moderators
Posted

So you want to put a 2D image to replace a 3D object in a 3D world ?

Can you show us the image you want to put ?

  • Moderators
Posted

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 ?

Posted (edited)

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
Posted (edited)
Not working.

Edit the image.. you've to draw your own one, click on THIS to see how to draw a image and your picture must be defined in the meta.. and it exist in your resource

dxDrawImage (sx,sy,sx,sy,"yourImage.png") --draw your image 

Edited by Guest
Posted

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) 

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

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