Emotions [Modular]

amxx reapi Emotions [Modular] 1.3

Нет прав для скачивания
Установка
  1. Скомпилируйте плагин (инструкция).
  2. Скопируйте скомпилированный файл .amxx в директорию: amxmodx/plugins/
  3. Пропишите .amxx в файле /amxmodx/configs/plugins.ini
Настройки
Конфиг:
Код:
[MENUS]
; <menu title> <menu key> <menu cmds>
"\yЭмоции 1"    "emotions"    "radio3, say /emotion"
"\yЭмоции 2"    "emotions2"    "radio2, say /emotion2"

[EMOTIONS]
; <menu key> <emotion name> <emotion key> <emotion sprite txt> <emotion sprite pickup> <emotion sprite up> <emotion sprite up frame>
; if sprite up doesn't have frames then just set value -1

"emotions"    "Грусть"    "cry"    "dev/roflaneb_01"    "dev/roflaneb.spr"    "dev/roflaneb_emup.spr"    "3"
"emotions2"    "ОМГ"    "omg"    "dev/roflaneb_02"    "dev/roflaneb.spr"    "dev/roflaneb_emup.spr"    "2"
"emotions"    "Моё уважение"    "pes"    "dev/roflaneb_03"    "dev/roflaneb.spr"    "dev/roflaneb_emup.spr"    "1"
"emotions2"    "РОФЛ"    "roflan"    "dev/roflaneb_04"    "dev/roflaneb.spr"    "dev/roflaneb_emup.spr"    "0"
Формат .txt файла:
Код:
<тип> <разрешение> <спрайт> <смещение_по_X> <смещение_по_Y> <ширина> <высота>
В исходнике:
Код:
new const EMOTIONS_FILE_NAME[] = "emotions.ini";

configs/plugins/plugin-emotions_control.cfg
Код:
// Emotion delay
// -
// Default: "5.0"
// Minimum: "0.500000"
emotions_delay "5.0"

В исходнике:
Код:
// Emotion sprite up scale
const Float:EMOTION_SPRITE_UP_SCALE = 0.15;

// Emotion sprite up classname
new const EMOTION_SPRITE_UP_CLASSNAME[] = "emotion_up";
API
Код:
#if defined _emotions_included
    #endinput
#endif
#define _emotions_included

#include <emotions_const>

/**
* Retrieves info (MenuData_s) about a menu by index.
*
* @param index                 Item index in the array
* @param temp_menu             Array data
*
* @return                      Error code
*/
native emotions_menu_getinfo(index, temp_menu[MenuData_s]);

/**
* Retrieves info (EmotionData_s) about a emotion by index.
*
* @param index                 Item index in the array
* @param temp_emotion          Array data
*
* @return                      Error code
*/
native emotions_emotion_getinfo(index, temp_emotion[EmotionData_s]);

/**
* Find a emotion index by key.
*
* @param emotion_key               Emotion key
*
* @return                          emotion index on success, -1 on error
*/
native emotions_emotion_find_index(emotion_key[MAX_EMOTION_KEY_LENGTH]);

/**
* Handler for menu.
*
* @param id        Player id
* @param menu      Menu id
* @param item      Item id
*
* @return          PLUGIN_CONTINUE to let a player to use emotion
*                  PLUGIN_HANDLED or higher to prevent a player to use emotion
*/
forward emotions_menu_handler(id, menu, item);

/**
* Callback for menu.
*
* @param id        Player id
* @param menu      Menu id
* @param item      Item id
*
* @return          ITEM_IGNOREAD to let a player to use item
*                  ITEM_DISABLED or higher to prevent use item
*/
forward emotions_menu_callback(id, menu, item);

Код:
#if defined _emotions_const_included
    #endinput
#endif
#define _emotions_const_included

enum
{
    EMOTION_ERR_INVALID_INDEX = 0,
    EMOTION_ERR_INVALID_KEY,
    EMOTION_ERR_ARRAY_EMPTY,
    EMOTION_ERR_SUCCESS
};

const MAX_MENU_NAME_LENGTH = 64;
const MAX_MENU_KEY_LENGTH = 16;
const MAX_MENU_CMDS_LENGTH = 128;

const MAX_EMOTION_NAME_LENGTH = 32;
const MAX_EMOTION_KEY_LENGTH = 24;
const MAX_EMOTION_SPRITE_LENGTH = 128;

enum _:MenuData_s
{
    MENU_ID,
    MENU_CALLBACK_ID,
    MENU_NAME[MAX_MENU_NAME_LENGTH],
    MENU_KEY[MAX_MENU_KEY_LENGTH],
    MENU_CMDS[MAX_MENU_CMDS_LENGTH]
};

enum _:EmotionData_s
{
    EMOTION_MENU_KEY[MAX_MENU_KEY_LENGTH],
    EMOTION_NAME[MAX_EMOTION_NAME_LENGTH],
    EMOTION_KEY[MAX_EMOTION_KEY_LENGTH],
    EMOTION_PICKUP_TXT[MAX_EMOTION_SPRITE_LENGTH],
    EMOTION_SPRITE_PICKUP[MAX_EMOTION_SPRITE_LENGTH],
    EMOTION_SPRITE_UP[MAX_EMOTION_SPRITE_LENGTH],
    EMOTION_SPRITE_UP_FRAME
};

Код:
#if defined _emotions_control_included
    #endinput
#endif
#define _emotions_control_included

/**
* Get emotion delay.
*
* @return          Delay
*/
native Float:emotions_get_emotion_delay();
Сверху Снизу