-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ca51ed
commit da6d1c8
Showing
33 changed files
with
4,836 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# Slot Machine | ||
|
||
_**English** | [Русский](README.ru.md)_ | ||
|
||
[![Slot Machine](https://img.youtube.com/vi/Y3zFFcCXAkc/0.jpg)](https://youtu.be/Y3zFFcCXAkc) | ||
|
||
AMX Mod X plugin for Counter-Strike. | ||
|
||
The plugin allows you to place slot machines on the map and play them. The player places a bet and waits for a winning combination of symbols to appear. A victory is counted when a whole row or main diagonal is filled with the same symbols. There is an API for adding your own prizes and a tool for customizing the slot machine model. | ||
|
||
## Commands | ||
* `slot_machine` — menu for placing slot machines on the map. | ||
|
||
## Configuration | ||
The plugin configuration is stored in the directory *addons/amxmodx/configs/slot_machine*. The file *_pattern.json* contains a 3 by 8 matrix with symbol markings for the reels of the slot machine. The symbol is defined by a number from 0 to 7. The symbol index is the same as the prize index. At the moment, it is not possible to change the dimension of the matrix. Example configuration file content: | ||
|
||
```json | ||
[ | ||
[0, 1, 2, 0, 3, 2, 4, 5], | ||
[1, 0, 2, 4, 0, 2, 3, 5], | ||
[2, 0, 3, 4, 2, 0, 5, 1] | ||
] | ||
``` | ||
|
||
### Adding your own prizes and bets | ||
The *next21_slot_machine.sma* source code file contains only the basic functionality of the plugin without issuing rewards. Prizes and bets must be implemented in a separate plugin using a dedicated API for this purpose: | ||
|
||
```pawn | ||
/** | ||
* Called when a client wins a slot machine | ||
* | ||
* @param iPlayer - Client index | ||
* @param iPrize - Prize index | ||
*/ | ||
forward client_slot_machine_win(const iPlayer, const iPrize) | ||
/** | ||
* Called before the slot machine is activated by the client | ||
* | ||
* @param iPlayer - Client index | ||
* @return - Use PLUGIN_HANDLED if you want to disable slot machine activation | ||
*/ | ||
forward client_slot_machine_spin(const iPlayer) | ||
``` | ||
|
||
The file *addons/amxmodx/scripting/next21_slot_machine_money.sma* contains an example of the implementation of the money system for a slot machine: | ||
|
||
```pawn | ||
#include <slotmachine> | ||
#define BET 100 | ||
new const GAME_PRIZES[] = | ||
{ | ||
200, | ||
300, | ||
500, | ||
800, | ||
1000, | ||
10000 | ||
} | ||
public client_slot_machine_win(const iPlayer, const iPrize) | ||
{ | ||
new iAddMoney = GAME_PRIZES[iPrize] | ||
rg_add_account(iPlayer, iAddMoney) | ||
} | ||
public client_slot_machine_spin(const iPlayer) | ||
{ | ||
if (get_member(iPlayer, m_iAccount) < BET) | ||
return PLUGIN_HANDLED | ||
rg_add_account(iPlayer, -BET) | ||
return PLUGIN_CONTINUE | ||
} | ||
``` | ||
|
||
### Customization of the slot machine model | ||
The script *slot_machine_texgen.py* allows you to relatively quickly generate the texture and UV-layout of the reels according to the specified parameters. For this you need: | ||
|
||
1) Place *addons/amxmodx/configs/slot_machine/_pattern.json* file in *cfg* directory. | ||
2) In the file *cfg/text.json* specify the names of bets and prizes, colors of text and shadows. | ||
3) Place images of reel symbols into the *symbols* directory. File names must match the symbol numbers (from 0 to 7). | ||
4) Run the script using the Python 3 interpreter. The [Pillow module](https://pillow.readthedocs.io/en/stable/) must be installed in the system. | ||
5) Compile with studiomdl or any other compiler the slot machine model in the *dist* directory. | ||
|
||
The quality of the generated textures may not be high enough. To solve this problem, it is proposed to re-save the resulting images with the png extension in any other raster editor (like GIMP). | ||
|
||
## Requirements | ||
- [Reapi](https://github.com/s1lentq/reapi) | ||
|
||
## Authors | ||
- [Psycrow](https://github.com/Psycrow101) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# Slot Machine | ||
|
||
_[English](README.md) | **Русский**_ | ||
|
||
[![Slot Machine](https://img.youtube.com/vi/Y3zFFcCXAkc/0.jpg)](https://youtu.be/Y3zFFcCXAkc) | ||
|
||
AMX Mod X плагин для Counter-Strike. | ||
|
||
Плагин позволяет размещать на карте слот машины (также известные как однорукие бандиты) и играть в них. Игрок делает ставку и ожидает выпадения выигрышной комбинации символов. Победа засчитывается при заполнении целого ряда или главной диагонали одинаковыми символами. Присутвует API для добавления собственных призов и вспомогательный инструмент для кастомизации модели игрового автомата. | ||
|
||
## Команды | ||
* `slot_machine` — меню размещения игровых автоматов на карте. | ||
|
||
## Настройки | ||
Конфигурация плагина хранится в директории *addons/amxmodx/configs/slot_machine*. В файле *_pattern.json* содержится матрица 3 на 8 с разметкой символов для барабанов игрового автомата. Символ определяется числом от 0 до 7. Индекс символа совпадает с индексом награды. На данный момент отсутствует возможность изменения размерности матрицы. Пример содержимого файла конфигурации: | ||
|
||
```json | ||
[ | ||
[0, 1, 2, 0, 3, 2, 4, 5], | ||
[1, 0, 2, 4, 0, 2, 3, 5], | ||
[2, 0, 3, 4, 2, 0, 5, 1] | ||
] | ||
``` | ||
|
||
### Добавление собственных призов и ставок | ||
Файл исходного кода *next21_slot_machine.sma* содержит только базовую функциональность плагина без выдачи наград. Призы и ставки должны быть реализованы в отдельном плагине при помощи выделенного для этой цели API: | ||
|
||
```pawn | ||
/** | ||
* Вызывается, когда клиент выигрывает в игровом автомате | ||
* | ||
* @param iPlayer - Индекс клиента | ||
* @param iPrize - Индекс награды | ||
*/ | ||
forward client_slot_machine_win(const iPlayer, const iPrize) | ||
/** | ||
* Вызывается перед активацией игрового автомата клиентом | ||
* | ||
* @param iPlayer - Индекс клиента | ||
* @return - Использовать PLUGIN_HANDLED при необходимости прервать активацию | ||
*/ | ||
forward client_slot_machine_spin(const iPlayer) | ||
``` | ||
|
||
В файле *addons/amxmodx/scripting/next21_slot_machine_money.sma* присутствует пример реализации денежной системы для слот машины: | ||
|
||
```pawn | ||
#include <slotmachine> | ||
// Денежная ставка | ||
#define BET 100 | ||
// Денежная награда | ||
new const GAME_PRIZES[] = | ||
{ | ||
200, | ||
300, | ||
500, | ||
800, | ||
1000, | ||
10000 | ||
} | ||
public client_slot_machine_win(const iPlayer, const iPrize) | ||
{ | ||
new iAddMoney = GAME_PRIZES[iPrize] | ||
rg_add_account(iPlayer, iAddMoney) | ||
} | ||
public client_slot_machine_spin(const iPlayer) | ||
{ | ||
if (get_member(iPlayer, m_iAccount) < BET) | ||
return PLUGIN_HANDLED | ||
rg_add_account(iPlayer, -BET) | ||
return PLUGIN_CONTINUE | ||
} | ||
``` | ||
|
||
### Изменение модели игрового автомата | ||
Скрипт *slot_machine_texgen.py* позволяет относительно быстро сгенерировать текстуру и UV-разметку барабанов по заданным параметрам. Для этого необходимо: | ||
|
||
1) Разместить файл *addons/amxmodx/configs/slot_machine/_pattern.json* в директорию *cfg*. | ||
2) В файле *cfg/text.json* указать названия ставок и призов, цвета надписей и тени. | ||
3) Разместить в директорию *symbols* изображения символов барабанов. Названия файлов должны совпадать с номерами символов (от 0 до 7). | ||
4) Запустить скрипт при помощи интерпретатора Python 3. В системе должен быть установлен модуль [Pillow](https://pillow.readthedocs.io/en/stable/). | ||
5) Скомпилировать с помощью studiomdl или любым другим компилятором модель игрового автомата в директори *dist*. | ||
|
||
Качество сгенерированных текстур может быть недостаточно высоким. Для решения данной проблемы предлагается пересохранить полученные изображения с расширением png в любом другом растровом редакторе (например GIMP). | ||
|
||
## Требования | ||
- [Reapi](https://github.com/s1lentq/reapi) | ||
|
||
## Авторы | ||
- [Psycrow](https://github.com/Psycrow101) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[ | ||
[0, 1, 2, 0, 3, 2, 4, 5], | ||
[1, 0, 2, 4, 0, 2, 3, 5], | ||
[2, 0, 3, 4, 2, 0, 5, 1] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[en] | ||
ALREADY_PLAYING = You are already playing on one slot machine! | ||
WIN_MONEY = ^1You won ^4%d$^1! | ||
NOT_ENOUGH_MONEY = ^1You don't have enough money! | ||
|
||
[ru] | ||
ALREADY_PLAYING = Вы уже играете на одном автомате! | ||
WIN_MONEY = ^1Вы выиграли ^4%d$^1! | ||
NOT_ENOUGH_MONEY = ^1У вас недостаточно денег! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#if defined _slotmachine_included | ||
#endinput | ||
#endif | ||
#define _slotmachine_included | ||
|
||
/** | ||
* Called when a client wins a slot machine | ||
* | ||
* @param iPlayer - Client index | ||
* @param iPrize - Prize index | ||
*/ | ||
forward client_slot_machine_win(const iPlayer, const iPrize) | ||
|
||
/** | ||
* Called before the slot machine is activated by the client | ||
* | ||
* @param iPlayer - Client index | ||
* @return - Use PLUGIN_HANDLED if you want to disable slot machine activation | ||
*/ | ||
forward client_slot_machine_spin(const iPlayer) |
Oops, something went wrong.