StarfallEx Documentation

repository·master·Indexed 42 days ago

https://github.com/thegrb93/starfallex

A sandboxed Lua execution environment for server-side and client-side scripting in Garry's Mod. Includes guides on installation via Steam Workshop or Git, binary module support for Joystick and XInput, and a permission system for defining custom access rules using SF.Permissions.registerProvider.

Tokens
1.1K
Snippets
3
Records
5
Agent score
3%

What's inside StarfallEx

  1. Install StarfallEx in Garry's Mod

    master

    You can install StarfallEx using one of three methods:

    1. Steam Workshop: Subscribe to the addon via the Steam Workshop.
    2. Git Clone: Clone the repository directly into your Garry's Mod addons folder.
    3. Manual Download: Download the source code as a ZIP, extract it, and place the contents into your addons folder.

    Addons Directory Path: C:\path\to\Steam\steamapps\common\GarrysMod\garrysmod\addons

    git clone https://github.com/thegrb93/StarfallEx "C:\path\to\Steam\steamapps\common\GarrysMod\garrysmod\addons\starfallex"
  2. Register a client-side permission provider

    master

    The StarfallEx permission system allows you to define custom access rules via providers. A provider is a table containing an id, name, settingsoptions, defaultsetting, and a list of checks.

    To register a provider, use SF.Permissions.registerProvider(providerTable).

    In the client-side implementation, providers typically validate whether the LocalPlayer() is the owner of the instance or a friend of the owner, and whether a HUD is currently active.

    local P = {
        id = "client",
        name = "Client Permissions",
        settingsoptions = { "Only You", "Friends Only", "Anyone", "Disabled", "HudEnabled" },
        defaultsetting = 3,
        overridable = true,
        checks = {
            -- Custom check functions return (bool, error_string)
            function(instance, target, key)
                return LocalPlayer() == instance.player, "This function can only be used on the player's own chip"
            end,
            -- ... other checks
        }
    }
    
    SF.Permissions.registerProvider(P)
  3. Configure Client Permission settings

    master

    When implementing or using a client-side permission provider, you can specify the following configuration keys in your provider table:

    • id: A unique identifier for the provider (e.g., "client").
    • name: The display name for the provider.
    • settingsoptions: A list of strings representing the available setting modes. For the default client provider, these are:
      • "Only You"
      • "Friends Only"
      • "Anyone"
      • "Disabled"
      • "HudEnabled"
    • defaultsetting: An integer index representing the default option from settingsoptions (e.g., 3 for "Anyone").
    • overridable: A boolean indicating if the permission settings can be overridden.
    P.settingsoptions = { "Only You", "Friends Only", "Anyone", "Disabled", "HudEnabled" }
    P.defaultsetting = 3
    P.overridable = true