[RELEASE][C#][FREE] Distinctive Development - Persistent Flashlight

DISTINCTIVE DEVELOPMENT - PERSISTENT FLASHLIGHT

A FiveM resource coded in C# to get a persistent flashlight in game.

The resource disables the current default GTA5 flashlight and uses the Fivem Native: DrawSpotlight to create flashlights for all players who have them enabled on the gun (same hotkey: “E”). Everything is synced with other players and the script remembers if the flashlight was on the particular gun when you get it out again, for example entering and exiting a car.

[PREVIEW]
DD-PERSISTENTFLASHLIGHT-YT

[CONFIG]
Default config with a yellowish flashlight
image
taserflashlight: true/false (enable or disable the flashlight on the taser, use lowercase)
The other variables are from the Fivem native DrawSpotlight (except pos and dir) and can be set in the config to change the flashlight to your own preference. Variables are set to INT in the code, so use whole numbers in the config, decimals won’t work.

[INSTALL INSTRUCTIONS]

  1. Download the latest release HERE
  2. Move the “DD-PERSISTENTFLASHLIGHT” folder to your server resources.
  3. Add “DD-PERSISTENTFLASHLIGHT” to your server.cfg with start or ensure
  4. Optional Configure the config
  5. Start the resource or reboot the serverr

[DOWNLOAD]
Download the latest release on GITHUB

[SOURCE CODE]
The source code is included inside the “source” folder on GITHUB

[CHANGELOG]
V1.1.3

  • Fixed click sound being played while not holding any weapons and pressing E

V1.1.2

  • Fixed bug with script getting the wrong ped

V1.1.1

  • FIXED issue that the script was not working

V1.1.0

  • Code improvements to enhance performance
  • Fixed some weaponhashes
  • Random fixes

V1.0.0

  • Initial release
9 Likes

Lmao, With all my respect on your work,
i don’t understand your logic, if that it’s free why are you using tebex store to share your ressource.

Use GitHub Comrad.

2 Likes

Why did you not use direct download or github for download?

Good point, didn’t think about that lol.
Will change it in a bit!

1 Like

Added it, thanks for the suggestion

Hey quick thing, is there anyway you could send me the code in here or just implement it in there. But whenever I keep the flashlight on and I step in a vehicle and I turn the wheel the flashlight turns with the wheel and I can see the flashlight all over the place. Maybe make it so whenever you step in the vehicle it turns the flashlight off? If you could do that please reply with a code that I myself could add to the code.

1 Like

You should also share your source code to let other if needed push or modify the code as they need/want.

Hey, thats actually in the code. It checks if you are in a car and isn’t gonna render the spotlight, I’ve tested it again and it works fine. So i’m unsure what the issue is on your end at the moment.

I might do that later on

1 Like

Theis is very resource intensive, can this be fixed? It’s takes just as much as CPU as my servers entire core?

C# check :upside_down_face:

but he can of course optimize this, this is also why i ask him to share his source code.

I thought it would have been on Github. So we can make edits to it.

@SeclusiveSolid
I’ve never seen the resource take that much cpu. The more people use the flashlight in the same location the more intensive it would be, thats true. How many people did you test this with?

@Ninja_force @StraightQuondo
I will create a github for this resource soon.

1 Like

@Ninja_force @StraightQuondo
Updated post with sourcecode on github

1 Like

alone in an empty server

Alone in an empty server:

Tested it on localhost and a Linux server with the Pterodactyl panel.

So i’m unsure how the resource is doing 0.52ms on your system

1 Like

Very strange, I will continue testing, thanks for the feedback

How do i make this work with addon weapons?