Best FiveM Programming Language?

As you know, you can make plugins with Lua, C#, and JavaScript. Luckily, I know all of these languages and I am curious of which one is the best to use? Personally I think its JS since you can use modules and what not but I am curious to hear what other people have to say.

Generally speaking, most people will use lua in fivem because of how easy it is to pick up so you’ll find the majority of community resources will be written in lua. For your own projects I would just recommend using whatever you like, personally i’m using typescript since it has types, classes, modules etc as you mention which aren’t present in lua.

1 Like

Biased opinion, but I prefer C#, I learned it specifically for use in FiveM. One of the benefits is you can use Externals in your code; they are a little old and don’t cover everything, but people are working on PRs to improve them. I also reckon C# is easier to pick up if you’ve got experience with OOP.

Random example:

PedProp hat = Game.PlayerPed.Style[PedProps.Hats];

int variationCount = hat.Count;
bool isWearingAHat = variationCount > -1;
string message = $"My ped {(isWearingAHat ? "is" : "is not")} wearing a hat!";

if (isWearingAHat)
    message += $" The hat has {variationCount} variations (currently using variation {hat.Index}), and {hat.TextureCount} textures (currently using {hat.TextureIndex})!";



local ped = PlayerPedId()
local hatIndex = GetPedPropIndex(ped, 0) -- 0 = hats
local isWearingAHat = hatIndex > -1
local message = "My ped " .. (isWearingAHat and "is" or "is not") .. " wearing a hat!"

if isWearingAHat then
    message = message .. " The hat has " .. GetNumberOfPedPropDrawableVariations(ped, 0) .. " variations (currently using variation " .. hatIndex .. "), and " .. GetNumberOfPedPropTextureVariations(ped, 0, hatIndex) .. " textures (currently using " .. GetPedPropTextureIndex(ped, 0) .. ")!"


To be clear, javascript/typescript also has this in the form of the fivem-js library or there are some more updated versions since the original author has passed away. These will help save a lot of time in development with their simplified classes and utility functions.