Description
Create the vouchers/codes/keys that allow players to get vip, credits, various bonuses and privileges by using them.
After using a voucher, the server executes the commands listed in the voucher.
Features
Create a random or specific vouchers/codes
Vouchers can send multiple server commands
Variables can be used for commands (steamid32, steamid64, userid, username)
Ability to create vouchers with a specified lifetime, after which the voucher will be deleted
Ability to create vouchers with a given number of uses of one voucher (there is protection against reuse of the voucher by one player)
If the player writes the voucher/code wrong several times (vouchers_attempts), he will be blocked for specific time (vouchers_block_time)
Logging block/unblock/deletion/voucher usage in sourcemod/logs/vouchers_core.txt
Screenshots
Spoiler
Video preview
Commands
Code:
sm_voucher (alias: vouchers;code;codes) - Opens menu with selections
sm_voucher <code> - Voucher usage
sm_voucher_gen "<translation_message>" <voucher_use_count> <voucher_lifetime> - Generate random voucher with parameters
sm_voucher_add <code> "<translation_message>" <voucher_use_count> <voucher_lifetime> - Create specific voucher with parameters
sm_voucher_cmds <code> "<commands>" - Add commands to voucher usage
sm_voucher_del <code> - Delete voucher
sm_voucher_unblock "<steamid>" - Unblocking the player from using the voucher command
translation_message - message from translation file (vouchers_messages.phrases.txt), this message will be sent after player uses the voucher (none - disable)
voucher_use_count - number of voucher uses (0 - unlimited)
voucher_lifetime - voucher lifetime (in minutes | 0 - forever)
commands - commands that the server sends after player uses the voucher (commands must be separated with ; Example: sm_slap userid;sm_blind @t;sm_beacon @ct)
steamid - player's steamid
Available variables
After player uses the voucher so server send specific commands,
commands can contain these variables:
steamid32
steamid64
userid
username
Example usage: sm_voucher_cmds TESTVOUCHER "sm_beacon username"
and if player with name "Nocky" uses the voucher: TESTVOUCHER so server send command: sm_beacon Nocky
Convars cfg/sourcemod/Vouchers.cfg
Code:
vouchers_attempts - Number of attempts to enter a voucher before obtaining a block (0 - Disabled)
vouchers_block_time - How many minutes will the player be blocked if they enter incorrect vouchers
Installation
Download files
Upload Vouchers.smx, vouchers.phrases.txt and vouchers_messages.phrases.txt
Add and configure custom messages in vouchers_messages.phrases.txt
To addons/sourcemod/configs/databases.cfg you need to add: