[Request] Simple c# script that contains all the basics for creating custom script in c#

I want to start creating some simple c# scripts, maybe with some GUI.
I don’t know how to make the server script communicate with the client script.
Do you have a simple c# script where I can understand the basics of creating a script for fivem?

Sorry for the bad english.

This link shows you how to setup a client script, loading the client lib and exporting correctly.

Do you know how to reference the correct libs for client scripting and server scripting?
If not then please read my post on this thread here:

As for server scripts communicating to client scripts you just need to use

TriggerClientEvent("EVENTNAME", parameters);

and add the following in the client script constructor:

public class ClassName : BaseScript 
{
    public ClassName() // CONSTRUCTOR
    {
     // SUBSCRIBING TO EVENT (WHICH  WILL CALL MethodNameToRun WHEN EVENT IS TRIGGERED)
     EventHandlers["EVENTNAME"] += new Action< parameter type >(MethodNameToRun);
    }
    
}

thanks, but if I want to communicate from client to server is the same (I change only TriggerServerEvent)?

Can I only put “TriggerClientEvent” inside a method or I can put it somewhere else?

And I don’t understand which functions I can use one the server script and which I can use on the client script

To do a server call it is just TriggerServerEvent(“EVENTNAME”) right enough for triggering server events, triggerclientevent can go in any method what so ever as well.

Ok thanks.
Another question, do you know the code in c# to create grafics like text, rectangle… for fivem?

I think you can just call them from this native https://runtime.fivem.net/doc/reference.html#_0x3A618A217E5154F0
its been a while since ive needed to do something like that though.

and is there something like this also for text?

Where can I call those functions?
Are they in the CitizenFx.net.dll?
If not, where can I find them, or how can I call them?

You call hashes like that with function.call