I want to create a private server (just for fun) and all the scripts in c# because I saw that c# is supported in fivem, but I don’t know where to start.
If i want to create a c# script, is it possible? The script is just a .cs file, or there is something else?
Are there any libraries to import in my .cs file?
All the scripts I saw (not many) are written in lua.
If the script can be written only in lua, what can i use c# for?
Sorry if there are any mistakes because I’m not english.
Well first off, I dont know your experiance but I will go over a few things basic things first, you will need to get used to (nativeDB / fivem references), you will use these to know what functions/hashes to use I prefer to use the fivem version since it shows everything very nicely edited.
Now comes server editing and client editing, so basically as you can reference the citizenFX lib found in your fivem install directory at
FiveM Application Data > citizen > clr2 > lib > mono > 4.5 > CitizenFX.core.dll
Now you can use the namespaces
citizenFX.Core;
citizenFX.Core.native;
citizenFX.Core.UI;
citizenFX.Core.NaturalMotion;
This gives you access to client side scripting and all its goodies, however, for the server side you will need to download the new FXserver (only the fx server supports c# server scripting) from https://runtime.fivem.net/artifacts/fivem
you can then extract it and set a reference at
FXserver > citizen > clr2 > lib > mono > 4.5 > citizenFX.core.dll
Now you can use the namespaces
citizenFX.Core;
citizenFX.Core.native;
This gives you access to server scripts for registering commands or telling clients to do something etc…
Now when you build your scripts you need to build them as a dll and when you save them you must make sure they are saved with .net in them like so: scriptname.net.dll. @mraes link shows you how to do it automatically. There isnt alot of c# guides out there but other useful links I tend to use include:
Thank you very much.
I alredy use fxserver and the correct link to download is this: /artifacts/fivem/ / FiveM Artifacts
But I have a problem.
I have imported the citizen.FX.core.dll but i can use only this 2 options
citizenFX.Core;
citizenFX.Core.native;
and not
citizenFX.Core.UI;
citizenFX.Core.NaturalMotion;
Do you now why?<img
That’s for server only, the lib in the fx server is for server scripting only so you don’t have access to client things. You must use the other lib I listed to make client scripts.