Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 28/04/25 in all areas

  1. MTA:SA Lua Enums - TypeScript-inspired Enumerations for Lua Overview A lightweight, type-safe enumeration library for Multi Theft Auto: San Andreas, bringing TypeScript-like enum functionality to Lua. This library provides a clean, intuitive way to define and use enumerations in your MTA:SA scripts. Key Features Multiple Syntax Styles: Create enums using traditional function calls or with a more elegant syntax similar to TypeScript Global and Local Enums: Define global enums for application-wide constants or local enums for module-specific use Type Safety: Validate enum values and prevent modification after creation Auto-incrementing Values: Automatically assign sequential values to enum members Utility Methods: Easily convert between enum values and names with built-in helper functions Example Usage -- Global enum with string name and curly braces enum 'Direction' { NORTH = 1, EAST = 2, SOUTH = 3, WEST = 4 } -- Local enum with direct table assignment local HttpStatus = enum { OK = 200, NOT_FOUND = 404, SERVER_ERROR = 500 } -- Auto-incrementing values enum 'Size' { "SMALL", "MEDIUM", "LARGE" } -- Using enum values local direction = Direction.NORTH local status = HttpStatus.OK -- Get name from value local directionName = Direction.getName(1) -- Returns "NORTH" -- Check if value belongs to enum if HttpStatus(200) then -- 200 is a valid HttpStatus value end Why Use This Library? Clean Code: Eliminate magic numbers and strings with descriptive enum constants Error Prevention: Catch typos and invalid values at runtime Self-documenting: Make your code more readable and maintainable Flexibility: Choose the syntax style that best fits your coding preferences Lightweight: Minimal overhead with no external dependencies Installation Simply include the enum.lua file in your project and add it to your meta.xml: <script src="path/to/enum.lua" type="shared" cache="false" /> Check out the full source code at: https://github.com/norelockk/mtasa-lua-enums This library is perfect for MTA:SA developers looking to write cleaner, more maintainable code with proper type safety. Whether you're building a simple gamemode or a complex resource, these enums will help organize your constants and prevent common errors.
    1 point
  2. @thebossofc O erro está dizendo que o 4º argumento do seu setPedAnimation deveria ser um número, mas vc colocou um true no lugar. setPedAnimation(source, "crack", "crckidle"..math.random(1,4), true, false, false, false ) -- 1 2 3 4 (era pra ser um número inteiro, o true é só depois) Faltou você declarar o parâmetro time. Normalmente o valor dele é -1.
    1 point
  3. Add the image with imgur or something, and make sure it has .png or any other image format at the end of the link.
    1 point
  4. Tak, ale plugin ten jest na tyle biedny, że podpowiada tylko funkcje. Niezależnie od tego czy plik jest ze strony serwera czy klienta. Właśnie to na celu ma mój program - ułatwić tworzenie zasobów. Przykładowo jeżeli będziemy mieli takie widzimisię stworzyć nowy zasób to zrobimy to stosunkowo łatwo wybierając odpowiednią opcję z menu. Proste, szybkie i skuteczne. Co do podpowiadania funkcji to również dołożę starań, by dołączyć do danych funkcji parametry wymagane i opcjonalne. Tak, by zminimalizować ilość wejść na wiki, a tym samym zmniejszyć czas tworzenia kodu. Wczoraj na swoim FP zamieściłem poglądowy wygląd tego IDE. Wygląda on tak: https://scontent-fra3-1.xx.fbcdn.net/hp ... 0515_o.png Aktualnie: - program samodzielnie znajduje ścieżkę dostępu do folderu MTA. - pobiera wszystkie dostępne w katalogu "resources" zasoby. - koloruje składnie. - parę drobnych rzeczy. Mam nadzieję, że się podoba i że skorzystacie z tego programu. Będzie on dostępny dla wszystkich za darmo. Będzie aktualizowany i mam nadzieję, że deweloperzy MTA zaimplementują go do MTA jako dodatkowy program przy instalacji(tak jak w przypadku PAWNO w SA-MP).
    1 point
×
×
  • Create New...