[Standalone] Laser sight script

Standalone Laser script

Simple laser script that will follow your taser weapon when you aim.

Features

  • Drag and drop
  • Client side keybinds (using key mapping)
  • Friendly Config
  • Supports all peds

Download

Github - NAT2K15

Preview

14 Likes

Nice looking good
do you know if there is anyway to have it so other can see it?
But still pretty cool

I have built it client side for now. In the feature, I am looking to add more guns and possibly make it server-side.

3 Likes

whoops whoop sound of the police. great script nat <3

1 Like

Thanks :grinning:

Ok nice can’t wait, keep up the good work!! :grin:

1 Like

I had been looking for this script for a while but I have bug fixes to tell you about.
The laser when it is aimed at long distances disappears.
The update time regarding the crosshair movement could be longer also since it has some delay. The synchronization with the server and the other players would also be a good idea.

But good job and keep up the good uptades and good scripts.

We built it that way in regards to disappearing when you aim to the sky. We tried without but when we do it caused issues so we decided to remove it. Now we can’t really fix the delay since there is no way around it.

1 Like

Great job man! Looking forward to the server-side version! (If it’s possible)

As an item or when a scope is add to weapon to be able to use. Would be cool too

1 Like

ASAP, tebex too I would love to support this

2 Likes

We don’t want money. We made this since my team and I love coding.

1 Like

WOOOOWW!! OMG SO GREAT!!! NAT YOU ARE SUCH A GOOD DEV!!! PLEASE MAKE MORE!!! I DROOL FOR YOUR CONTENT :weary:

1 Like

Cool now join arrow mods!

1 Like

For this release, I LOVE you! :heart:

1 Like

waiting for u to make it to be server side , it will be really good

1 Like

Wow i see a lot of people asking to make that server-side replicated

but tbh i don’t think it will be a good idea to make it.
the idea is that, to make some thing replicated you will need to pass by “Event” or using Decor (Since we don’t have any documentation it will be more harder to make it with Decors (but i’will try w’ill see).

The thing is that, you will need to synchronise that in loop imagine 100 or more than 10 players calling that event on loop i don’t think it will be a good idea for performence again even more you will get an overflow.

But what i can do for now to help you @nat2k15 Is to add some optimization on your script.
Update your RegisterCommandEvent by this :

local timer_opti = 1000

RegisterCommand('+taser_toggle', function()
	local ped = PlayerPedId()
	if GetSelectedPedWeapon(ped) == GetHashKey("WEAPON_STUNGUN") then
		if enabled then
			enabled = false
			timer_opti = 1000
			displaytext("Laser has been ~r~Disabled")
		else
			displaytext("Laser has been ~g~Enabled")
			Citizen.CreateThread(function()
				enabled = true
				while enabled do 
					timer_opti = 1000
					local camview = GetFollowPedCamViewMode()
					local crouch = GetPedStealthMovement(ped)
					if IsPlayerFreeAiming(PlayerId()) then
						if GetSelectedPedWeapon(ped) == GetHashKey("WEAPON_STUNGUN") then
							timer_opti = 0
							local weapon = GetSelectedPedWeapon(ped)
							local playerloc = GetPedBoneCoords(ped, 0x6F06)
							local offset = GetOffsetFromEntityInWorldCoords(PlayerPedId(), 0.0, 105.0, 0.0)
							local hit, coords, value3 = RayCastPed(playerloc, 15000, ped)
							if hit ~= 0 then
								if camview == 4 and crouch == 1 then
									playerlockZ = playerlockZ -0.30
								else 
									playerlockZ = playerlockZ
								end
DrawLine(playerloc.x, playerloc.y, playerloc.z, coords.x, coords.y, coords.z, config.LaserColorR, config.LaserColorG, config.LaserColorB, config.LaserColorA)
								DrawSphere2(coords, 0.01, config.LaserColorR, config.LaserColorG, config.LaserColorB, config.LaserColorA)
							end
						end
					end
					Citizen.Wait(timer_opti)
				end
			end)
		end
	end
end, false)

Alright ill take a look later tonight. Now yeah i do agree with you server side can cause a lot of issues.

I mean if you know how to use Decors well it can be op, but i didn’t see any documentation on it.

Never really used it. But it’s always fun to learn so ill take a look later tonight. I am looking into adding more guns to the laser script. But the bones were annoying to deal with.