Skip to Content
Game plugins

SA-MP and open.mp

The FluteSampConnect filterscript for SA-MP and open.mp: install with pawn-requests, link to the site, players by nickname, bans, reports, the menu and the gamemode integration.

Your SA-MP or open.mp server is integrated with the site through the GameLink filterscript, which keeps the server and the site in sync. The site sees who is online, bans by nickname, takes reports and shows its menu in dialogs. Money, VIP and items are handed out by your gamemode; the filterscript passes the site's commands on to it.

PlatformArchiveSetup commandSite module
SA-MP / open.mpflute-samp-filterscript-<VERSION>.zipflute_setup <site url> <token>SampKit

Releases are on GitHub. The server page in the admin also offers the latest build with a "Download" button.

What you get

The filterscript tells the site who is online with ping, score, kills and time on the server, plus the host name, version, map and tick rate. The site answers with commands: kick, message, ban, block chat, and everything else goes to the gamemode. Each command runs at most once, even after a restart.

In the gameWhat the site needs
players by nickname, linking, sign-in link, balance, menu, online playersthe SampKit module
bans and chat blocksthe Sentinel module
player statisticsthe Stats module, though it does not count nicknames yet, see below
/report reportsthe Reports module
online players on the monitoring pagethe Monitoring module
groups, money, itemsactions your gamemode declares, and a module that sends them (GiveCore, Rewards rewards)

Without SampKit the site does not know SA-MP players: SA-MP has no Steam, so the site knows a player by nickname.

Requirements

SA-MP 0.3.7 or 0.3.DL, or open.mp; CR:MP servers work too. You need the pawn-requests 0.11.1 plugin: the Linux build is in the release archive, on Windows take the stock requests.dll. The filterscript has been tested on open.mp 1.6.7 on Linux.

Install

Unpack the archive into the server folder. It holds:

filterscripts/
├── flute_link.amx
└── flute_link.pwn
include/
└── flute_link.inc          for the gamemode integration
plugins/
├── requests.so
└── requests-LICENSE.txt
src/flute/                  sources

Use the requests.so from the archive, not the one from the pawn-requests release. The stock file brings the server down on the first failed request (site down, certificate refused); the archive's copy logs the error and retries.

Load the plugin and the filterscript:

server.cfg
plugins requests.so
filterscripts flute_link

On Windows plugins takes requests.

On the first start the filterscript writes scriptfiles/flute_link.ini with every key and a comment, and prints [Flute] Not connected to a site yet: flute_setup <site url> <server token> in the server console.

Issue a token

Open AdminServers, then your server and its "Plugins" tab. Click "Issue token" and copy the command from the window. The step is covered in detail in connecting a server.

Run the command in the server console

flute_setup https://<YOUR_DOMAIN> <SERVER_TOKEN>

Type it in the server console or over remote RCON. While a player in the game is logged in as an RCON admin, the filterscript refuses it: the server does not tell a script where a command came from.

Pick the player check

Open "For power users: security, command queue, in-game menu" and, under "Security", set "Player authentication". If the gamemode asks for a password on join and tells the filterscript about the login, pick "Offline with a password login". Otherwise pick "Offline". In the default "Licensed" mode the site refuses nicknames.

The Security block with the player authentication choice

The console shows [Flute] Connected to https://<YOUR_DOMAIN> (server #N). and the "Plugins" tab shows "Connected". flute_status shows the address, the last sync, the last error, the realm and the actions the gamemode declared at any time.

The address and token are saved to scriptfiles/flute_link.ini. The token is never printed, but the console log keeps the command you typed. If other people read that log, write url and token into the file and run reloadfs flute_link.

The server sent players its player check turns away

The admin shows this line on the "Plugins" tab while the player check is set to "Licensed". The site does not see those players, and purchases do not reach them. Pick "Offline" or "Offline with a password login" under "Security".

Players and nicknames

The site knows a player as <realm>:<nickname> in lower case, for example main:john_smith. The realm is set in the config and is main by default. Servers sharing one account base use the same realm; servers with separate bases use different ones, and the same nickname on them counts as two players.

A nickname is 3 to 24 characters of letters, digits and [ ] _ $ = ( ) @ .. With any other nickname the player sees "The site does not accept this nickname, so site features are off for you." A player who renames on the server is a new player for the site.

The server cannot prove a nickname belongs to a person. So in "Offline" mode a player can link the nickname but cannot sign in to the site from the game or pay with the balance. To open everything, the gamemode must check a password and report the login with FluteLink_PlayerLoggedIn, and the site must be set to "Offline with a password login".

The player gets a code on the site in "Profile → Settings → Linked accounts", with the "Get code" button, types /link CODE in game and confirms the link on the site.

What each feature does

Bans and chat blocks

Needs the Sentinel module. A ban or chat block from the site goes into the filterscript's own list by nickname, with a duration. The ban is checked on join, and the player sees "You are banned on this server until … Reason: …". If your admin system bans and mutes on the server, the gamemode reports that to the site with FluteLink_ReportSanction. There is no voice mute unless the gamemode declares one (with SampVoice, for example).

Statistics

The Stats module counts SA-MP events when the player check is "Offline with a password login": Stats takes a nickname confirmed by a password as the player's account. In "Offline" mode the /stats table stays empty for the server, even though the filterscript sends the events. Deaths go to the site right away, and once a minute a player.stats event follows: shots, hits, damage to players, suicides, team kills (same SetPlayerTeam team) and NPCs killed. Shots and hits come from OnPlayerWeaponShot, which needs lag compensation. While the site is down the counters wait in memory. The killer and weapon are reported by the victim's client, so a modified client can name anyone.

Reports

Needs the Reports module. /report opens a list of players, then the reasons. /report name or /report id jumps straight to the reasons. The site gets the target's kills, deaths and score and up to 10 of their chat lines from the last 5 minutes. One report on the same player per 5 minutes, at most three per 10 minutes from one nickname.

In-game menu

/site opens the site menu in dialogs, /sitesettings its settings. The menu is built in AdminServersIn-game menu (In-game menu). In SA-MP it is text in dialogs: no images, descriptions, QR codes or text input. Text is converted to the server's code page, ₽ becomes RUB and emoji are dropped. The game cannot open a link, so it arrives in chat and in a dialog.

Money, VIP and items

The filterscript delivers nothing itself: it passes the action to the gamemode. The gamemode declares what it can do, economy.deposit and group.add for example, and runs them in FluteLink_OnAction. The site sees that list and sells only what the server will deliver. On the site money is the "Server credits" reward, and a group is the "Server group by name" reward or a GiveCore privilege. Any console command can go out as the "Server command" reward when the config has allow_raw = 1.

Gamemode integration

Include include/flute_link.inc in the gamemode. The calls go through CallRemoteFunction, so the gamemode runs the same without the filterscript loaded.

gamemode.pwn
#include <flute_link>

public FluteLink_OnReady()
{
    FluteLink_UseLogin();
    FluteLink_DeclareAction("economy.deposit");
    return 1;
}

// after the password check
FluteLink_PlayerLoggedIn(playerid);

public FluteLink_OnAction(commandid, playerid, const action[], const nick[], const args[])
{
    if (!strcmp(action, "economy.deposit"))
    {
        new cents = FluteLink_ArgCents(args, "amount");
        if (cents <= 0) return FLUTE_INVALID;
        // add cents / 100 to the account of nick
        return FLUTE_DONE;
    }
    return FLUTE_UNSUPPORTED;
}

playerid is INVALID_PLAYER_ID when the player is offline. Give everything in one call: a command that failed halfway is delivered again. A repeat of a command that already ran is answered by the filterscript and never reaches the gamemode.

FunctionWhat it does
FluteLink_UseLogin()a player reaches the site only after FluteLink_PlayerLoggedIn
FluteLink_PlayerLoggedIn(playerid), FluteLink_PlayerLoggedOut(playerid)login and logout in the gamemode's account
FluteLink_DeclareAction(name)an action the gamemode runs. Call it in FluteLink_OnReady
FluteLink_OnAction(...)return FLUTE_DONE, FLUTE_FAILED, FLUTE_INVALID, FLUTE_UNSUPPORTED, FLUTE_DEFER_OFFLINE, FLUTE_DEFER_DEAD, FLUTE_DEFER_FULL or FLUTE_PENDING
FluteLink_Complete(commandid, status, reason[])the outcome of a pending action, within 4 minutes
FluteLink_ReportSanction(...)a ban, mute or chat block your admin system issued or lifted
FluteLink_SendEvent(playerid, type, data)your own event for site modules; data is a JSON object
FluteLink_ArgString, FluteLink_ArgInt, FluteLink_ArgBool, FluteLink_ArgCentsread arguments. ArgCents turns "12.50" into 1250 without floats

Commands and permissions

CommandWhoWhat it does
flute_setup <url> <token>server console, remote RCONsaves the address and token and connects
flute_statusserver console, RCONlink state, queue, gamemode actions
reloadfs flute_linkserver console, RCONrereads flute_link.ini
/link CODEplayerlinks the nickname to the site account
/siteloginplayerone-time sign-in link
/sitebalanceplayersite balance
/site, /sitesettingsplayersite menu and its settings
/report [name or id]playerreports a player

The commands carry a site prefix because a filterscript sees commands before the gamemode, and many gamemodes already have their own /login, /balance and /menu. /report is taken over: if the gamemode has its own, rename cmd_report or leave it empty.

Config

scriptfiles/flute_link.ini; run reloadfs flute_link after editing. Values go without quotes.

scriptfiles/flute_link.ini
url = https://<YOUR_DOMAIN>
token = <SERVER_TOKEN>
realm = main
language = en
codepage = 1252
KeyDefaultWhat it changes
url, tokenemptysite address (a sub-folder works) and the token
allow_http0allow an http:// address, only for a site on the same machine
realmmainnickname name space on the site, a-z 0-9 _ -, up to 32 characters
languageenplayer messages: en, ru, uk
codepage1251client code page: 1251 (Cyrillic) or 1252 (Western European)
allow_raw0allow console commands from the site
raw_blacklistrcon_password, password, rcon, exit, gmx, changemode, loadfs, unloadfs, reloadfs, loadplugin, exec, flute_setupfirst words the site may never run. Some of them, plus bind, alias and flute_*, are always refused
report_deaths, report_stats1send deaths and player.stats
cmd_link, cmd_login, cmd_balance, cmd_menu, cmd_settingslink, sitelogin, sitebalance, site, sitesettingscommands without the /; an empty value switches one off
cmd_reportreportthe report command; empty switches reports off
report_reasonscheat, abuse, grief, othercomma-separated reasons, optionally with a label: rp:Breaking RP rules. Up to 12
report_same_target_seconds300pause between reports on the same player
report_max, report_window_seconds3, 600reports from one nickname per window
report_chat_lines10how many of the target's chat lines go with a report, 0–10
dialog_id32700dialog id of the menu; change it if the gamemode uses it
chat_prefixemptymessage prefix; empty takes [Site] in the player's language
platform_softwareemptywhat the site shows as the server software. Set CR:MP on a CR:MP server

State (commands run in the last day, unsent events, the ban and block lists) lives in scriptfiles/flute_link.db.

Troubleshooting

For any other message, use the error lookup.

flute_setup refused: an RCON admin is logged in in the game

Someone in the game is logged in as an RCON admin. Run the command in the server console while nobody like that is in, or write the address and token into flute_link.ini and run reloadfs flute_link.

Console messageWhat to do
The token must start with flute_srv_copy the token again from the window on the "Plugins" tab
The site address must start with https://the address has no scheme or is in quotes. Write https://… without quotes
http:// is refuseduse an https:// address. For a site on the same machine set allow_http = 1
The site rejected the keythe token was reset or revoked. Issue a new one and run flute_setup again
Sync failed: …the reason follows the colon. For invalid_signature check the server clock (NTP)
realm "…" is not a-z 0-9 _ - (1-32 chars)fix realm; the filterscript kept the old one
dialog_id must be 1-32767set dialog_id within that range
pawn-requests refused the site address.check url, and on Linux that the requests.so from the archive is loaded

If a purchase did not reach the player, open AdminServersSent to servers (Sent to servers). On SA-MP "The server plugin cannot do this. Update the plugin" usually means the gamemode has not declared that action. While the filterscript is connected the site does not send such a command at all, so it never shows up there: check the Actions from the gamemode line of flute_status.

More

On this page