Key check library
Status codes
Every code check_key can return, what it means, and what to tell the player.
Key check codes
check_key(key) always returns a table with code, a human-readable message and optional data:
lua
local status = lib.check_key(key)
print(status.code, status.message)| Code | Meaning | What to show |
|---|---|---|
KEY_VALID | The key is valid for this script. | Continue — call load_script(). |
KEY_INCORRECT | The key does not exist. | "Invalid key — get a new one." Open get_key_url(). |
KEY_EXPIRED | The key's time is up. | "Your key expired — get a new one." |
KEY_BANNED | The key is disabled, its Discord account / device is banned, or a one-time key was already used. message says which. | "This key can't be used." Show status.message. |
KEY_HWID_LOCKED | The key is bound to another device. | "Reset your HWID" — point to your Discord bot panel. |
SCRIPT_ID_INCORRECT | The script doesn't belong to this key's service. | Check lib.script_id. |
KEY_PREMIUM_REQUIRED | A standard key on a Premium Service (service setting) or on a script with Premium keys only (Obfuscation). | "This script requires a premium key." Show status.message. |
SCRIPT_DISABLED | You turned on the script's kill-switch (Obfuscation). | Show status.message — your disable message, "This script is temporarily disabled by its developer." by default. |
KEY_INVALID | Client-side: empty key or shorter than 4 characters. | "Enter your key." |
NETWORK_ERROR | Client-side: the API couldn't be reached. | "Couldn't reach the server, try again." |
UNKNOWN | Client-side: the server answered without a code. | Show status.message and let the player retry. |
Handling them
lua
local messages = {
KEY_INCORRECT = "Invalid key. Press 'Get key' to get a new one.",
KEY_EXPIRED = "Your key has expired.",
KEY_HWID_LOCKED = "Key is locked to another device. Reset your HWID.",
NETWORK_ERROR = "Couldn't reach the server. Try again.",
}
local status = lib.check_key(key)
if status.code == "KEY_VALID" then
lib.load_script()
else
label.Text = messages[status.code] or status.message
endKicks from the built-in whitelist
Without the library, the embedded whitelist kicks instead of returning a code:
| Kick message | Cause |
|---|---|
No key found | No script_key was set. |
Server message, e.g. The provided key does not exist | The key failed validation. |
| Security / integrity kick | Hooking or tampering was detected, or the session couldn't be verified. |