Fundamentals: your first resource · Lesson 6/6 · 6 min

Best practices and your roadmap

The habits that separate a hobbyist script from a production-grade one, and where to go next.

You already know the basics. These habits will make your resources clean, secure and easy to maintain:

  • Configuration in config.lua, never «magic» values scattered through the code.
  • Events named resource:side:action, clear and collision-free.
  • Database with oxmysql and parameterized queries (?), never concatenating strings.
  • Secrets (keys, tokens) out of the code: in convars/server.cfg.
  • Always server-authoritative: the client asks, the server decides.
  • Program defensively: check for nil before using.

If you internalize «the client is never trustworthy», you're already ahead of most scripts floating around out there (many of them carry backdoors precisely because they ignore this).

What's coming

In the next modules: frameworks (ESX/QBCore), client and server in depth, database with oxmysql, NUI interfaces, advanced debugging, anti-backdoor security and a final project where you'll build a complete resource from start to finish.

Challenge: code it yourself

Take the /cobrar command and refactor it so that ALL values (payment, cooldown, messages) come from Config.

Write it yourself in your editor (VS Code) and test it on your server. You learn here by doing it, not by copying.

See hint

Move the texts to Config.Mensajes = { ... } and read them from there.

Escribe aquí tu solución:

How was this lesson?