English
Sign in

Questions and problems

My plugin does not load

"the player has left"

A Player (or Entity) was used after its player left (or its entity was removed), usually in a timer. Check player.connected (or entity.valid) first, or give the timer { player = p } so it ends when the player leaves.

My plugin was paused

After 20 errors within a minute a plugin is paused, so a broken handler cannot flood the console. Fix the error the console printed, then plugin resume <name> (or plugin reload <name>).

"the call took longer than sv_plugin_budget_ms"

One call into the plugin ran for over 100 ms and was stopped. Something loops too long, or waits: use Database:query instead of query_now, cs.read_file_async instead of cs.read_file, split big work over several frames with cs.after(0, ...).

The server stutters with my plugin

plugin prof shows the cost of each handler per frame. Look for work in frame, player_move, player_pre_think and player_post_think, which run for every player every frame. Move it to a timer, or do it only when something changed.

Players do not see my model, sound or sprite

My before handler changes nothing

Only fields the reference marks writable can be changed, only in before handlers ({ before = true }), and only on events that run before the game acts. ev:block() works only on blockable events.

Can my plugin read files outside its folder, or run programs?

No. Plugins are sandboxed: they read their own folder, write their data folder (plugin_data/<name>/), and reach the network only through cs.http, cs.websocket and (with the raw_sockets permission) cs.tcp/cs.udp, to the hosts their manifest lists. A server admin who needs more can allow a native module, which runs without a sandbox.

How do I keep data between maps and restarts?

The plugin's Luau variables live across maps, until the plugin reloads or the server stops; player:data() until the player leaves or the map changes. For anything longer use cs.store (key-value) or cs.database (SQLite), keyed by player.id.

How do I port an AMX Mod X plugin?

cs_port (in data/plugin_sdk/cs_port/) translates Pawn to Luau over compat/amxx, a layer with the familiar function names. See Porting.

Where are complete examples?

Read the shipped plugins and reference mods: they are complete, working examples of almost everything in the API.