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
11 hours ago, 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)

 

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
4 hours ago, 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

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
1 hour ago, 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)

 

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
On 18/06/2020 at 21:01, MrKAREEM said:

see this topic it will help you

 

I know, I've looked at it before this but it's not what i was looking for. I fixed it anyway by making an empty sniper scope with no crosshair and added a crosshair over it

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