Help with codes and understanding some limits

What are the basic limits of scripting, how big can we make the scripts?

How many times can we call Citizen.CreateThread(function() without crashing out, and how to make functions in them more optermized.

At the moment I have a new Citizen.CreateThread for the hide username function I seen about free with out no real explaintion how they work but mine as a problem, until I restart the mod it will flicker the user names like made.

if FoxFix.GameSettings.HideNameTags then
	Citizen.CreateThread(function()
		while true do
			for i=0,99 do
				N_0x31698aa80e0223f8(i)
			end
			for i=0, 32 do
                                GrabPlayer = GetPlayerPed(i);
				if(NetworkIsPlayerActive(i) and GrabPlayer) then
					local Blip = GetBlipFromEntity(GrabPlayer)
					if DoesBlipExist(Blip) then
						SetThisScriptCanRemoveBlipsCreatedByAnyScript(true);
						SetBlipScale(Blip, 0.0)
					end
				end
			end
			Citizen.Wait(0)
		end
	end)
end

so lets say I am [1]BadKaiPanda and my wife who is [2]Toffee, out tags flash like mad until I do a restart dufx

Is this because I doing something wrong, two many threads? I don’t have many mods installed at this point it’s mostly my own mod running on my server.

I am debating if I need N_0x31698aa80e0223f8(i) as none of the scipts I read said WHY this is needed, I know most copy and past and don’t care long as it works but I trying to make my scripts and server set up work the way I want it so I need to understand what things are doing.

Also any other tips would be great, like I creating my scipts and then release them like I have been doing but I want to start adding banks(bank/cash) and other things like jobs, big problem I been seeing when others have been setting these up are databases.

Do we know what the pros and cons would be using a json/lua/texttable file or something like this rather then a db?

One Pro I see it will mean only one mod set up and users wont have to worry about setting up a host for a mysql but do we have speed problems or read right problems?

How many times can we call Citizen.CreateThread(function()

Within reason™, not really something you should worry about. The costs of Citizen.CreateThread is fairly low. I advice to not hold back on those, since it’s not worth the hassle.

Probably due to you not calling it every frame (I’m not aware if you actually should call it every frame :thinking:)

No see above.

https://runtime.fivem.net/doc/reference.html#_0x31698AA80E0223F8

It seems to remove the multiplayer player tag, this is why your “out tags” are flashing?

This covers the pros/cons

1 Like

Thanks for the information :slight_smile:

I did ad the function here, is is called soon as the client lua is loaded far as I was to understand, unless there is something I have to tweak,

I am trying to remove the tags :slight_smile: so is the loop after this not needed is that one removed them anyway.

Has anyone else got a idea why it’s flashing like mad until you do a restart MODNAME command?

Can you define “it”, you mean the blips or the gamer tag? Or player name?

They Syntasu, I wasn’t even updated on this no notification so sorry about the lat reply, yes the name tags above the name flash’s like made, but if you reload it it stops it from doing it until the next restart, since it stops doing it on a reload I not sure why it’s doing it, it’s doing it on a vanilla server as well as a esx server.

I seen many servers having other problems like it so they set it to a dot but I would rather get to the bottom if why it does it in the first place, since it works soon as you restart it.