Jump to content

Help with sniper crosshair


Volltron

Recommended Posts

I'm trying to change the whole sniper crosshair and scope but I get black bars instead of an empty screen when i aim with sniper
Is there any way i can get rid of the black bars ?

local shader = dxCreateShader("textureS.fx");
local texture = dxCreateTexture("empty.png");
dxSetShaderValue(shader, "crosshair_sniper", texture);
engineApplyShaderToWorldTexture(shader, "snipercrosshair");
engineApplyShaderToWorldTexture(shader, "cameracrosshair");

https://i.imgur.com/gwD8ovY.png


 

Edited by Volltron
Link to comment

For what i see in others servers, people use this to create a new crossair and change it when the player want 

function onClientRender ()
	if (getPedWeapon(localPlayer) == 34) then
		if ((getPedTask(localPlayer, "secondary", 0) == "TASK_SIMPLE_USE_GUN") and getPedControlState("aim_weapon")) then
			local sW,sH = guiGetScreenSize()
			dxDrawImage(0, 0, sW, sH, "crosshair.png", 0, 0, 0, tocolor(255, 255, 255, 255), true)
		end
	end
end
addEventHandler("onClientRender",root,onClientRender)

 

Link to comment
  On 18/06/2020 at 00:03, RekZ said:

For what i see in others servers, people use this to create a new crossair and change it when the player want 

function onClientRender ()
	if (getPedWeapon(localPlayer) == 34) then
		if ((getPedTask(localPlayer, "secondary", 0) == "TASK_SIMPLE_USE_GUN") and getPedControlState("aim_weapon")) then
			local sW,sH = guiGetScreenSize()
			dxDrawImage(0, 0, sW, sH, "crosshair.png", 0, 0, 0, tocolor(255, 255, 255, 255), true)
		end
	end
end
addEventHandler("onClientRender",root,onClientRender)

 

Expand  

Yes that's what I tried but the problem is the black bars and I was wondering if there's any way of just getting rid of them or if I have to get used to that and work with it
https://i.imgur.com/2Vgw4w8.png

Link to comment
  On 18/06/2020 at 11:49, Volltron said:

Yes that's what I tried but the problem is the black bars and I was wondering if there's any way of just getting rid of them or if I have to get used to that and work with it
https://i.imgur.com/2Vgw4w8.png

Expand  

i dont think you can delete this bars, but you can change resolution of crosshair.png and you shloud get nice crosshair

  • Thanks 1
Link to comment
  On 18/06/2020 at 11:49, Volltron said:

Yes that's what I tried but the problem is the black bars and I was wondering if there's any way of just getting rid of them or if I have to get used to that and work with it
https://i.imgur.com/2Vgw4w8.png

Expand  
local sW,sH = guiGetScreenSize() -- Get Windows Resolution dont need to be render 

function onClientRender ()
	if (getPedWeapon(localPlayer) == 34) then
		if ((getPedTask(localPlayer, "secondary", 0) == "TASK_SIMPLE_USE_GUN") and getPedControlState("aim_weapon")) then
			if isPlayerHudComponentVisible("crosshair") then
				setPlayerHudComponentVisible("crosshair",false) 
			end
			dxDrawImage(0, 0, sW, sH, "crosshair.png", 0, 0, 0, tocolor(255, 255, 255, 255), true)
		else
			if not isPlayerHudComponentVisible("crosshair") then
				setPlayerHudComponentVisible("crosshair",true) 
			end
		end
	else
		if not isPlayerHudComponentVisible("crosshair") then
			setPlayerHudComponentVisible("crosshair",true) 
		end
	end
end
addEventHandler("onClientRender",root,onClientRender)

 

Edited by RekZ
  • Thanks 1
Link to comment
  On 18/06/2020 at 16:35, RekZ said:

local sW,sH = guiGetScreenSize() -- Get Windows Resolution dont need to be render 

function onClientRender ()
	if (getPedWeapon(localPlayer) == 34) then
		if ((getPedTask(localPlayer, "secondary", 0) == "TASK_SIMPLE_USE_GUN") and getPedControlState("aim_weapon")) then
			if isPlayerHudComponentVisible("crosshair") then
				setPlayerHudComponentVisible("crosshair",false) 
			end
			dxDrawImage(0, 0, sW, sH, "crosshair.png", 0, 0, 0, tocolor(255, 255, 255, 255), true)
		else
			if not isPlayerHudComponentVisible("crosshair") then
				setPlayerHudComponentVisible("crosshair",true) 
			end
		end
	else
		if not isPlayerHudComponentVisible("crosshair") then
			setPlayerHudComponentVisible("crosshair",true) 
		end
	end
end
addEventHandler("onClientRender",root,onClientRender)

 

Expand  

Same thing happens, but thank you anyway. I think there's just no way of getting rid of the black side bars when zooming in with the sniper

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