- Регистрация
- 29 Май 2019
- Сообщения
- 14
- Лучшие ответы
- 0
- Репутация
- 0
Хороший инвентарь samp на текстдравах модерн-стиля с нуля, так сказать. Ушло времени ~3 часа суммарно.
Коллбэки:
OnPlayerItem(playerid, itemid); - Вызывается при использовании предмета под id %itemid% в инвентаре.
OnPlayerDropItem(playerid, itemid); - Вызывается при выбрасывании предмета под id %itemid% в инвентаре. (Динамической системы с 3д объектами дропа нет, вы сами можете реализовать, простите)
Критикуйте)
Коллбэки:
OnPlayerItem(playerid, itemid); - Вызывается при использовании предмета под id %itemid% в инвентаре.
OnPlayerDropItem(playerid, itemid); - Вызывается при выбрасывании предмета под id %itemid% в инвентаре. (Динамической системы с 3д объектами дропа нет, вы сами можете реализовать, простите)
Критикуйте)
PHP:
// Author: keytruth
#include <a_samp>
#define MAX_ITEMS (4)
#define MAX_INV_CELLS (12)
#define INV_DIALOG_INFO (384)
enum eInventory
{
Name[16],
Info[128],
Model
}
new const Item[MAX_ITEMS][eInventory] =
{
{"Sprunk", "Газированная вода.", 13562},
{"Pizza", "Пицца с колбасой и сыром.", 2814},
{"Shawarma", "Вкусненькая шаурма.", 2769},
{"Shotgun", "Достаточно мощный помповый дробовик.", 349}
};
new Text: InventoryHUD[MAX_PLAYERS][6],
Text: InventoryCell[MAX_PLAYERS][MAX_INV_CELLS],
Text: InventoryCC[MAX_PLAYERS][MAX_INV_CELLS],
bool: InventoryShow[MAX_PLAYERS],
InventoryCS[MAX_PLAYERS],
Inventory[MAX_PLAYERS][MAX_ITEMS],
LocalInventory[MAX_PLAYERS][MAX_INV_CELLS];
public OnPlayerConnect(playerid)
{
InventoryShow[playerid] = false;
InventoryCS[playerid] = -1;
for(new i; i != MAX_ITEMS; i++)
{
Inventory[playerid][i] = 0;
}
for(new i; i != MAX_INV_CELLS; i++)
{
LocalInventory[playerid][i] = -1;
}
return 1;
}
public OnGameModeInit()
{
for(new i; i != MAX_PLAYERS; i++)
{
InventoryHUD[i][0] = TextDrawCreate(160.000000, 120.000000, "_");
TextDrawBackgroundColor(InventoryHUD[i][0], 255);
TextDrawFont(InventoryHUD[i][0], 1);
TextDrawLetterSize(InventoryHUD[i][0], 1.300000, 16.199996);
TextDrawColor(InventoryHUD[i][0], -1);
TextDrawSetOutline(InventoryHUD[i][0], 0);
TextDrawSetProportional(InventoryHUD[i][0], 1);
TextDrawSetShadow(InventoryHUD[i][0], 1);
TextDrawUseBox(InventoryHUD[i][0], 1);
TextDrawBoxColor(InventoryHUD[i][0], 742281471);
TextDrawTextSize(InventoryHUD[i][0], 454.000000, 31.000000);
TextDrawSetSelectable(InventoryHUD[i][0], 0);
InventoryHUD[i][1] = TextDrawCreate(171.000000, 126.000000, "_");
TextDrawBackgroundColor(InventoryHUD[i][1], 877223679);
TextDrawFont(InventoryHUD[i][1], 5);
TextDrawLetterSize(InventoryHUD[i][1], 0.500000, 1.000000);
TextDrawColor(InventoryHUD[i][1], -1);
TextDrawSetOutline(InventoryHUD[i][1], 0);
TextDrawSetProportional(InventoryHUD[i][1], 1);
TextDrawSetShadow(InventoryHUD[i][1], 1);
TextDrawUseBox(InventoryHUD[i][1], 0);
TextDrawBoxColor(InventoryHUD[i][1], 255);
TextDrawTextSize(InventoryHUD[i][1], 86.000000, 118.000000);
TextDrawSetPreviewModel(InventoryHUD[i][1], 3045);
TextDrawSetPreviewRot(InventoryHUD[i][1], -16.000000, 0.000000, 0.000000, 1.000000);
TextDrawSetSelectable(InventoryHUD[i][1], 0);
InventoryCell[i][0] = TextDrawCreate(266.000000, 126.000000, "_");
TextDrawBackgroundColor(InventoryCell[i][0], 877223679);
TextDrawFont(InventoryCell[i][0], 5);
TextDrawLetterSize(InventoryCell[i][0], 0.500000, 1.000000);
TextDrawColor(InventoryCell[i][0], -1);
TextDrawSetOutline(InventoryCell[i][0], 0);
TextDrawSetProportional(InventoryCell[i][0], 1);
TextDrawSetShadow(InventoryCell[i][0], 1);
TextDrawUseBox(InventoryCell[i][0], 0);
TextDrawBoxColor(InventoryCell[i][0], 255);
TextDrawTextSize(InventoryCell[i][0], 40.000000, 36.000000);
TextDrawSetPreviewModel(InventoryCell[i][0], 3045);
TextDrawSetPreviewRot(InventoryCell[i][0], -16.000000, 0.000000, -55.000000, 1.000000);
TextDrawSetSelectable(InventoryCell[i][0], 1);
InventoryCC[i][0] = TextDrawCreate(290.000000, 125.000000, "_");
TextDrawBackgroundColor(InventoryCC[i][0], 255);
TextDrawFont(InventoryCC[i][0], 1);
TextDrawLetterSize(InventoryCC[i][0], 0.270000, 1.100000);
TextDrawColor(InventoryCC[i][0], -1);
TextDrawSetOutline(InventoryCC[i][0], 0);
TextDrawSetProportional(InventoryCC[i][0], 1);
TextDrawSetShadow(InventoryCC[i][0], 0);
TextDrawSetSelectable(InventoryCC[i][0], 0);
InventoryCell[i][1] = TextDrawCreate(312.000000, 126.000000, "_");
TextDrawBackgroundColor(InventoryCell[i][1], 877223679);
TextDrawFont(InventoryCell[i][1], 5);
TextDrawLetterSize(InventoryCell[i][1], 0.500000, 1.000000);
TextDrawColor(InventoryCell[i][1], -1);
TextDrawSetOutline(InventoryCell[i][1], 0);
TextDrawSetProportional(InventoryCell[i][1], 1);
TextDrawSetShadow(InventoryCell[i][1], 1);
TextDrawUseBox(InventoryCell[i][1], 0);
TextDrawBoxColor(InventoryCell[i][1], 255);
TextDrawTextSize(InventoryCell[i][1], 40.000000, 36.000000);
TextDrawSetPreviewModel(InventoryCell[i][1], 3045);
TextDrawSetPreviewRot(InventoryCell[i][1], -16.000000, 0.000000, -55.000000, 1.000000);
TextDrawSetSelectable(InventoryCell[i][1], 1);
InventoryCC[i][1] = TextDrawCreate(336.000000, 125.000000, "_");
TextDrawBackgroundColor(InventoryCC[i][1], 255);
TextDrawFont(InventoryCC[i][1], 1);
TextDrawLetterSize(InventoryCC[i][1], 0.270000, 1.100000);
TextDrawColor(InventoryCC[i][1], -1);
TextDrawSetOutline(InventoryCC[i][1], 0);
TextDrawSetProportional(InventoryCC[i][1], 1);
TextDrawSetShadow(InventoryCC[i][1], 0);
TextDrawSetSelectable(InventoryCC[i][1], 0);
InventoryCell[i][2] = TextDrawCreate(358.000000, 126.000000, "_");
TextDrawBackgroundColor(InventoryCell[i][2], 877223679);
TextDrawFont(InventoryCell[i][2], 5);
TextDrawLetterSize(InventoryCell[i][2], 0.500000, 1.000000);
TextDrawColor(InventoryCell[i][2], -1);
TextDrawSetOutline(InventoryCell[i][2], 0);
TextDrawSetProportional(InventoryCell[i][2], 1);
TextDrawSetShadow(InventoryCell[i][2], 1);
TextDrawUseBox(InventoryCell[i][2], 0);
TextDrawBoxColor(InventoryCell[i][2], 255);
TextDrawTextSize(InventoryCell[i][2], 40.000000, 36.000000);
TextDrawSetPreviewModel(InventoryCell[i][2], 3045);
TextDrawSetPreviewRot(InventoryCell[i][2], -16.000000, 0.000000, -55.000000, 1.000000);
TextDrawSetSelectable(InventoryCell[i][2], 1);
InventoryCC[i][2] = TextDrawCreate(382.000000, 125.000000, "_");
TextDrawBackgroundColor(InventoryCC[i][2], 255);
TextDrawFont(InventoryCC[i][2], 1);
TextDrawLetterSize(InventoryCC[i][2], 0.270000, 1.100000);
TextDrawColor(InventoryCC[i][2], -1);
TextDrawSetOutline(InventoryCC[i][2], 0);
TextDrawSetProportional(InventoryCC[i][2], 1);
TextDrawSetShadow(InventoryCC[i][2], 0);
TextDrawSetSelectable(InventoryCC[i][2], 0);
InventoryCell[i][3] = TextDrawCreate(405.000000, 126.000000, "_");
TextDrawBackgroundColor(InventoryCell[i][3], 877223679);
TextDrawFont(InventoryCell[i][3], 5);
TextDrawLetterSize(InventoryCell[i][3], 0.500000, 1.000000);
TextDrawColor(InventoryCell[i][3], -1);
TextDrawSetOutline(InventoryCell[i][3], 0);
TextDrawSetProportional(InventoryCell[i][3], 1);
TextDrawSetShadow(InventoryCell[i][3], 1);
TextDrawUseBox(InventoryCell[i][3], 0);
TextDrawBoxColor(InventoryCell[i][3], 255);
TextDrawTextSize(InventoryCell[i][3], 40.000000, 36.000000);
TextDrawSetPreviewModel(InventoryCell[i][3], 3045);
TextDrawSetPreviewRot(InventoryCell[i][3], -16.000000, 0.000000, -55.000000, 1.000000);
TextDrawSetSelectable(InventoryCell[i][3], 1);
InventoryCC[i][3] = TextDrawCreate(429.000000, 125.000000, "_");
TextDrawBackgroundColor(InventoryCC[i][3], 255);
TextDrawFont(InventoryCC[i][3], 1);
TextDrawLetterSize(InventoryCC[i][3], 0.270000, 1.100000);
TextDrawColor(InventoryCC[i][3], -1);
TextDrawSetOutline(InventoryCC[i][3], 0);
TextDrawSetProportional(InventoryCC[i][3], 1);
TextDrawSetShadow(InventoryCC[i][3], 0);
TextDrawSetSelectable(InventoryCC[i][3], 0);
InventoryCell[i][4] = TextDrawCreate(266.000000, 167.000000, "_");
TextDrawBackgroundColor(InventoryCell[i][4], 877223679);
TextDrawFont(InventoryCell[i][4], 5);
TextDrawLetterSize(InventoryCell[i][4], 0.500000, 1.000000);
TextDrawColor(InventoryCell[i][4], -1);
TextDrawSetOutline(InventoryCell[i][4], 0);
TextDrawSetProportional(InventoryCell[i][4], 1);
TextDrawSetShadow(InventoryCell[i][4], 1);
TextDrawUseBox(InventoryCell[i][4], 0);
TextDrawBoxColor(InventoryCell[i][4], 255);
TextDrawTextSize(InventoryCell[i][4], 40.000000, 36.000000);
TextDrawSetPreviewModel(InventoryCell[i][4], 3045);
TextDrawSetPreviewRot(InventoryCell[i][4], -16.000000, 0.000000, -55.000000, 1.000000);
TextDrawSetSelectable(InventoryCell[i][4], 1);
InventoryCC[i][4] = TextDrawCreate(289.000000, 166.000000, "_");
TextDrawBackgroundColor(InventoryCC[i][4], 255);
TextDrawFont(InventoryCC[i][4], 1);
TextDrawLetterSize(InventoryCC[i][4], 0.270000, 1.100000);
TextDrawColor(InventoryCC[i][4], -1);
TextDrawSetOutline(InventoryCC[i][4], 0);
TextDrawSetProportional(InventoryCC[i][4], 1);
TextDrawSetShadow(InventoryCC[i][4], 0);
TextDrawSetSelectable(InventoryCC[i][4], 0);
InventoryCell[i][5] = TextDrawCreate(312.000000, 167.000000, "_");
TextDrawBackgroundColor(InventoryCell[i][5], 877223679);
TextDrawFont(InventoryCell[i][5], 5);
TextDrawLetterSize(InventoryCell[i][5], 0.500000, 1.000000);
TextDrawColor(InventoryCell[i][5], -1);
TextDrawSetOutline(InventoryCell[i][5], 0);
TextDrawSetProportional(InventoryCell[i][5], 1);
TextDrawSetShadow(InventoryCell[i][5], 1);
TextDrawUseBox(InventoryCell[i][5], 0);
TextDrawBoxColor(InventoryCell[i][5], 255);
TextDrawTextSize(InventoryCell[i][5], 40.000000, 36.000000);
TextDrawSetPreviewModel(InventoryCell[i][5], 3045);
TextDrawSetPreviewRot(InventoryCell[i][5], -16.000000, 0.000000, -55.000000, 1.000000);
TextDrawSetSelectable(InventoryCell[i][5], 1);
InventoryCC[i][5] = TextDrawCreate(336.000000, 166.000000, "_");
TextDrawBackgroundColor(InventoryCC[i][5], 255);
TextDrawFont(InventoryCC[i][5], 1);
TextDrawLetterSize(InventoryCC[i][5], 0.270000, 1.100000);
TextDrawColor(InventoryCC[i][5], -1);
TextDrawSetOutline(InventoryCC[i][5], 0);
TextDrawSetProportional(InventoryCC[i][5], 1);
TextDrawSetShadow(InventoryCC[i][5], 0);
TextDrawSetSelectable(InventoryCC[i][5], 0);
InventoryCell[i][6] = TextDrawCreate(358.000000, 167.000000, "_");
TextDrawBackgroundColor(InventoryCell[i][6], 877223679);
TextDrawFont(InventoryCell[i][6], 5);
TextDrawLetterSize(InventoryCell[i][6], 0.500000, 1.000000);
TextDrawColor(InventoryCell[i][6], -1);
TextDrawSetOutline(InventoryCell[i][6], 0);
TextDrawSetProportional(InventoryCell[i][6], 1);
TextDrawSetShadow(InventoryCell[i][6], 1);
TextDrawUseBox(InventoryCell[i][6], 0);
TextDrawBoxColor(InventoryCell[i][6], 255);
TextDrawTextSize(InventoryCell[i][6], 40.000000, 36.000000);
TextDrawSetPreviewModel(InventoryCell[i][6], 3045);
TextDrawSetPreviewRot(InventoryCell[i][6], -16.000000, 0.000000, -55.000000, 1.000000);
TextDrawSetSelectable(InventoryCell[i][6], 1);
InventoryCC[i][6] = TextDrawCreate(382.000000, 166.000000, "_");
TextDrawBackgroundColor(InventoryCC[i][6], 255);
TextDrawFont(InventoryCC[i][6], 1);
TextDrawLetterSize(InventoryCC[i][6], 0.270000, 1.100000);
TextDrawColor(InventoryCC[i][6], -1);
TextDrawSetOutline(InventoryCC[i][6], 0);
TextDrawSetProportional(InventoryCC[i][6], 1);
TextDrawSetShadow(InventoryCC[i][6], 0);
TextDrawSetSelectable(InventoryCC[i][6], 0);
InventoryCell[i][7] = TextDrawCreate(405.000000, 167.000000, "_");
TextDrawBackgroundColor(InventoryCell[i][7], 877223679);
TextDrawFont(InventoryCell[i][7], 5);
TextDrawLetterSize(InventoryCell[i][7], 0.500000, 1.000000);
TextDrawColor(InventoryCell[i][7], -1);
TextDrawSetOutline(InventoryCell[i][7], 0);
TextDrawSetProportional(InventoryCell[i][7], 1);
TextDrawSetShadow(InventoryCell[i][7], 1);
TextDrawUseBox(InventoryCell[i][7], 0);
TextDrawBoxColor(InventoryCell[i][7], 255);
TextDrawTextSize(InventoryCell[i][7], 40.000000, 36.000000);
TextDrawSetPreviewModel(InventoryCell[i][7], 3045);
TextDrawSetPreviewRot(InventoryCell[i][7], -16.000000, 0.000000, -55.000000, 1.000000);
TextDrawSetSelectable(InventoryCell[i][7], 1);
InventoryCC[i][7] = TextDrawCreate(429.000000, 166.000000, "_");
TextDrawBackgroundColor(InventoryCC[i][7], 255);
TextDrawFont(InventoryCC[i][7], 1);
TextDrawLetterSize(InventoryCC[i][7], 0.270000, 1.100000);
TextDrawColor(InventoryCC[i][7], -1);
TextDrawSetOutline(InventoryCC[i][7], 0);
TextDrawSetProportional(InventoryCC[i][7], 1);
TextDrawSetShadow(InventoryCC[i][7], 0);
TextDrawSetSelectable(InventoryCC[i][7], 0);
InventoryCell[i][8] = TextDrawCreate(266.000000, 208.000000, "_");
TextDrawBackgroundColor(InventoryCell[i][8], 877223679);
TextDrawFont(InventoryCell[i][8], 5);
TextDrawLetterSize(InventoryCell[i][8], 0.500000, 1.000000);
TextDrawColor(InventoryCell[i][8], -1);
TextDrawSetOutline(InventoryCell[i][8], 0);
TextDrawSetProportional(InventoryCell[i][8], 1);
TextDrawSetShadow(InventoryCell[i][8], 1);
TextDrawUseBox(InventoryCell[i][8], 0);
TextDrawBoxColor(InventoryCell[i][8], 255);
TextDrawTextSize(InventoryCell[i][8], 40.000000, 36.000000);
TextDrawSetPreviewModel(InventoryCell[i][8], 3045);
TextDrawSetPreviewRot(InventoryCell[i][8], -16.000000, 0.000000, -55.000000, 1.000000);
TextDrawSetSelectable(InventoryCell[i][8], 1);
InventoryCC[i][8] = TextDrawCreate(289.000000, 207.000000, "_");
TextDrawBackgroundColor(InventoryCC[i][8], 255);
TextDrawFont(InventoryCC[i][8], 1);
TextDrawLetterSize(InventoryCC[i][8], 0.270000, 1.100000);
TextDrawColor(InventoryCC[i][8], -1);
TextDrawSetOutline(InventoryCC[i][8], 0);
TextDrawSetProportional(InventoryCC[i][8], 1);
TextDrawSetShadow(InventoryCC[i][8], 0);
TextDrawSetSelectable(InventoryCC[i][8], 0);
InventoryCell[i][9] = TextDrawCreate(312.000000, 208.000000, "_");
TextDrawBackgroundColor(InventoryCell[i][9], 877223679);
TextDrawFont(InventoryCell[i][9], 5);
TextDrawLetterSize(InventoryCell[i][9], 0.500000, 1.000000);
TextDrawColor(InventoryCell[i][9], -1);
TextDrawSetOutline(InventoryCell[i][9], 0);
TextDrawSetProportional(InventoryCell[i][9], 1);
TextDrawSetShadow(InventoryCell[i][9], 1);
TextDrawUseBox(InventoryCell[i][9], 0);
TextDrawBoxColor(InventoryCell[i][9], 255);
TextDrawTextSize(InventoryCell[i][9], 40.000000, 36.000000);
TextDrawSetPreviewModel(InventoryCell[i][9], 3045);
TextDrawSetPreviewRot(InventoryCell[i][9], -16.000000, 0.000000, -55.000000, 1.000000);
TextDrawSetSelectable(InventoryCell[i][9], 1);
InventoryCC[i][9] = TextDrawCreate(336.000000, 207.000000, "_");
TextDrawBackgroundColor(InventoryCC[i][9], 255);
TextDrawFont(InventoryCC[i][9], 1);
TextDrawLetterSize(InventoryCC[i][9], 0.270000, 1.100000);
TextDrawColor(InventoryCC[i][9], -1);
TextDrawSetOutline(InventoryCC[i][9], 0);
TextDrawSetProportional(InventoryCC[i][9], 1);
TextDrawSetShadow(InventoryCC[i][9], 0);
TextDrawSetSelectable(InventoryCC[i][9], 0);
InventoryCell[i][10] = TextDrawCreate(358.000000, 208.000000, "_");
TextDrawBackgroundColor(InventoryCell[i][10], 877223679);
TextDrawFont(InventoryCell[i][10], 5);
TextDrawLetterSize(InventoryCell[i][10], 0.500000, 1.000000);
TextDrawColor(InventoryCell[i][10], -1);
TextDrawSetOutline(InventoryCell[i][10], 0);
TextDrawSetProportional(InventoryCell[i][10], 1);
TextDrawSetShadow(InventoryCell[i][10], 1);
TextDrawUseBox(InventoryCell[i][10], 0);
TextDrawBoxColor(InventoryCell[i][10], 255);
TextDrawTextSize(InventoryCell[i][10], 40.000000, 36.000000);
TextDrawSetPreviewModel(InventoryCell[i][10], 3045);
TextDrawSetPreviewRot(InventoryCell[i][10], -16.000000, 0.000000, -55.000000, 1.000000);
TextDrawSetSelectable(InventoryCell[i][10], 1);
InventoryCC[i][10] = TextDrawCreate(382.000000, 207.000000, "_");
TextDrawBackgroundColor(InventoryCC[i][10], 255);
TextDrawFont(InventoryCC[i][10], 1);
TextDrawLetterSize(InventoryCC[i][10], 0.270000, 1.100000);
TextDrawColor(InventoryCC[i][10], -1);
TextDrawSetOutline(InventoryCC[i][10], 0);
TextDrawSetProportional(InventoryCC[i][10], 1);
TextDrawSetShadow(InventoryCC[i][10], 0);
TextDrawSetSelectable(InventoryCC[i][10], 0);
InventoryCell[i][11] = TextDrawCreate(405.000000, 208.000000, "_");
TextDrawBackgroundColor(InventoryCell[i][11], 877223679);
TextDrawFont(InventoryCell[i][11], 5);
TextDrawLetterSize(InventoryCell[i][11], 0.500000, 1.000000);
TextDrawColor(InventoryCell[i][11], -1);
TextDrawSetOutline(InventoryCell[i][11], 0);
TextDrawSetProportional(InventoryCell[i][11], 1);
TextDrawSetShadow(InventoryCell[i][11], 1);
TextDrawUseBox(InventoryCell[i][11], 0);
TextDrawBoxColor(InventoryCell[i][11], 255);
TextDrawTextSize(InventoryCell[i][11], 40.000000, 36.000000);
TextDrawSetPreviewModel(InventoryCell[i][11], 3045);
TextDrawSetPreviewRot(InventoryCell[i][11], -16.000000, 0.000000, -55.000000, 1.000000);
TextDrawSetSelectable(InventoryCell[i][11], 1);
InventoryCC[i][11] = TextDrawCreate(429.000000, 207.000000, "_");
TextDrawBackgroundColor(InventoryCC[i][11], 255);
TextDrawFont(InventoryCC[i][11], 1);
TextDrawLetterSize(InventoryCC[i][11], 0.270000, 1.100000);
TextDrawColor(InventoryCC[i][11], -1);
TextDrawSetOutline(InventoryCC[i][11], 0);
TextDrawSetProportional(InventoryCC[i][11], 1);
TextDrawSetShadow(InventoryCC[i][11], 0);
TextDrawSetSelectable(InventoryCC[i][11], 0);
InventoryHUD[i][2] = TextDrawCreate(173.000000, 248.000000, "______Use");
TextDrawBackgroundColor(InventoryHUD[i][2], 255);
TextDrawFont(InventoryHUD[i][2], 1);
TextDrawLetterSize(InventoryHUD[i][2], 0.500000, 1.000000);
TextDrawColor(InventoryHUD[i][2], -1);
TextDrawSetOutline(InventoryHUD[i][2], 0);
TextDrawSetProportional(InventoryHUD[i][2], 1);
TextDrawSetShadow(InventoryHUD[i][2], 0);
TextDrawUseBox(InventoryHUD[i][2], 1);
TextDrawBoxColor(InventoryHUD[i][2], 877223679);
TextDrawTextSize(InventoryHUD[i][2], 255.000000, 14.000000);
TextDrawSetSelectable(InventoryHUD[i][2], 1);
InventoryHUD[i][3] = TextDrawCreate(268.000000, 248.000000, "_____Drop");
TextDrawBackgroundColor(InventoryHUD[i][3], 255);
TextDrawFont(InventoryHUD[i][3], 1);
TextDrawLetterSize(InventoryHUD[i][3], 0.500000, 1.000000);
TextDrawColor(InventoryHUD[i][3], -1);
TextDrawSetOutline(InventoryHUD[i][3], 0);
TextDrawSetProportional(InventoryHUD[i][3], 1);
TextDrawSetShadow(InventoryHUD[i][3], 0);
TextDrawUseBox(InventoryHUD[i][3], 1);
TextDrawBoxColor(InventoryHUD[i][3], 877223679);
TextDrawTextSize(InventoryHUD[i][3], 350.000000, 14.000000);
TextDrawSetSelectable(InventoryHUD[i][3], 1);
InventoryHUD[i][4] = TextDrawCreate(360.000000, 248.000000, "______Info");
TextDrawBackgroundColor(InventoryHUD[i][4], 255);
TextDrawFont(InventoryHUD[i][4], 1);
TextDrawLetterSize(InventoryHUD[i][4], 0.500000, 1.000000);
TextDrawColor(InventoryHUD[i][4], -1);
TextDrawSetOutline(InventoryHUD[i][4], 0);
TextDrawSetProportional(InventoryHUD[i][4], 1);
TextDrawSetShadow(InventoryHUD[i][4], 0);
TextDrawUseBox(InventoryHUD[i][4], 1);
TextDrawBoxColor(InventoryHUD[i][4], 877223679);
TextDrawTextSize(InventoryHUD[i][4], 443.000000, 14.000000);
TextDrawSetSelectable(InventoryHUD[i][4], 1);
InventoryHUD[i][5] = TextDrawCreate(160.000000, 108.000000, "Inventory");
TextDrawBackgroundColor(InventoryHUD[i][5], 0);
TextDrawFont(InventoryHUD[i][5], 1);
TextDrawLetterSize(InventoryHUD[i][5], 0.270000, 1.000000);
TextDrawColor(InventoryHUD[i][5], -1);
TextDrawSetOutline(InventoryHUD[i][5], 0);
TextDrawSetProportional(InventoryHUD[i][5], 1);
TextDrawSetShadow(InventoryHUD[i][5], 0);
TextDrawUseBox(InventoryHUD[i][5], 1);
TextDrawBoxColor(InventoryHUD[i][5], 877223679);
TextDrawTextSize(InventoryHUD[i][5], 454.000000, 30.000000);
TextDrawSetSelectable(InventoryHUD[i][5], 0);
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if((newkeys & KEY_YES) && (!InventoryShow[playerid])) ShowInventory(playerid);
return 1;
}
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
if(InventoryShow[playerid])
{
if(clickedid != Text: INVALID_TEXT_DRAW)
{
if(InventoryCS[playerid] == -1)
{
if(clickedid == InventoryCell[playerid][0]) InventoryCS[playerid] = 0;
else if(clickedid == InventoryCell[playerid][1]) InventoryCS[playerid] = 1;
else if(clickedid == InventoryCell[playerid][2]) InventoryCS[playerid] = 2;
else if(clickedid == InventoryCell[playerid][3]) InventoryCS[playerid] = 3;
else if(clickedid == InventoryCell[playerid][4]) InventoryCS[playerid] = 4;
else if(clickedid == InventoryCell[playerid][5]) InventoryCS[playerid] = 5;
else if(clickedid == InventoryCell[playerid][6]) InventoryCS[playerid] = 6;
else if(clickedid == InventoryCell[playerid][7]) InventoryCS[playerid] = 7;
else if(clickedid == InventoryCell[playerid][8]) InventoryCS[playerid] = 8;
else if(clickedid == InventoryCell[playerid][9]) InventoryCS[playerid] = 9;
else if(clickedid == InventoryCell[playerid][10]) InventoryCS[playerid] = 10;
else if(clickedid == InventoryCell[playerid][11]) InventoryCS[playerid] = 11;
TextDrawBackgroundColor(InventoryCell[playerid][InventoryCS[playerid]], 0x243545FF);
TextDrawHideForPlayer(playerid, InventoryCell[playerid][InventoryCS[playerid]]);
TextDrawShowForPlayer(playerid, InventoryCell[playerid][InventoryCS[playerid]]);
}
else
{
if(clickedid == InventoryHUD[playerid][2])
{
if(Inventory[playerid][LocalInventory[playerid][InventoryCS[playerid]]] > 0)
{
Inventory[playerid][LocalInventory[playerid][InventoryCS[playerid]]]--;
UpdateInventory(playerid);
OnPlayerItem(playerid, Inventory[playerid][LocalInventory[playerid][InventoryCS[playerid]]]);
}
}
if(clickedid == InventoryHUD[playerid][3])
{
if(Inventory[playerid][LocalInventory[playerid][InventoryCS[playerid]]] > 0)
{
Inventory[playerid][LocalInventory[playerid][InventoryCS[playerid]]] = 0;
UpdateInventory(playerid);
OnPlayerDropItem(playerid, Inventory[playerid][LocalInventory[playerid][InventoryCS[playerid]]]);
}
}
if(clickedid == InventoryHUD[playerid][4])
{
new buf[128];
format(buf, sizeof buf, "{FFFFFF}%s:\n\n%s", Item[LocalInventory[playerid][InventoryCS[playerid]]][Name], Item[LocalInventory[playerid][InventoryCS[playerid]]][Info]);
ShowPlayerDialog(playerid, INV_DIALOG_INFO, DIALOG_STYLE_MSGBOX, "{FFFFFF}Информация", buf, "Закрыть", "");
}
if(clickedid == InventoryCell[playerid][InventoryCS[playerid]])
{
TextDrawBackgroundColor(InventoryCell[playerid][InventoryCS[playerid]], 877223679);
TextDrawHideForPlayer(playerid, InventoryCell[playerid][InventoryCS[playerid]]);
TextDrawShowForPlayer(playerid, InventoryCell[playerid][InventoryCS[playerid]]);
InventoryCS[playerid] = -1;
}
}
}
else return HideInventory(playerid);
}
return 0;
}
ShowInventory(playerid)
{
InventoryCS[playerid] = -1;
for(new i; i < 6; i++)
{
TextDrawShowForPlayer(playerid, InventoryHUD[playerid][i]);
}
for(new i; i < MAX_INV_CELLS; i++)
{
TextDrawShowForPlayer(playerid, InventoryCell[playerid][i]);
TextDrawShowForPlayer(playerid, InventoryCC[playerid][i]);
}
UpdateInventory(playerid);
InventoryShow[playerid] = true;
SelectTextDraw(playerid, 0xA3A3A3FF);
return 1;
}
UpdateInventory(playerid)
{
for(new i; i != MAX_INV_CELLS; i++)
{
LocalInventory[playerid][i] = -1;
}
TextDrawHideForPlayer(playerid, InventoryHUD[playerid][1]);
TextDrawSetPreviewModel(InventoryHUD[playerid][1], GetPlayerSkin(playerid));
TextDrawShowForPlayer(playerid, InventoryHUD[playerid][1]);
new li = 0,
buf[4];
for(new i; i != MAX_INV_CELLS; i++)
{
for(new j = li; j != MAX_ITEMS; j++)
{
if(Inventory[playerid][j] > 0)
{
TextDrawHideForPlayer(playerid, InventoryCell[playerid][i]);
TextDrawSetPreviewModel(InventoryCell[playerid][i], Item[j][Model]);
TextDrawShowForPlayer(playerid, InventoryCell[playerid][i]);
TextDrawHideForPlayer(playerid, InventoryCC[playerid][i]);
format(buf, sizeof buf, "%d", Inventory[playerid][j]);
TextDrawSetString(InventoryCC[playerid][i], buf);
TextDrawShowForPlayer(playerid, InventoryCC[playerid][i]);
li++;
LocalInventory[playerid][i] = j;
break;
}
else
{
TextDrawHideForPlayer(playerid, InventoryCell[playerid][i]);
TextDrawSetPreviewModel(InventoryCell[playerid][i], 3045);
TextDrawShowForPlayer(playerid, InventoryCell[playerid][i]);
TextDrawHideForPlayer(playerid, InventoryCC[playerid][i]);
TextDrawSetString(InventoryCC[playerid][i], "_");
TextDrawShowForPlayer(playerid, InventoryCC[playerid][i]);
li++;
}
}
}
return 1;
}
HideInventory(playerid)
{
for(new i; i < 6; i++)
{
TextDrawHideForPlayer(playerid, InventoryHUD[playerid][i]);
}
for(new i; i < MAX_INV_CELLS; i++)
{
TextDrawHideForPlayer(playerid, InventoryCell[playerid][i]);
TextDrawHideForPlayer(playerid, InventoryCC[playerid][i]);
}
if(InventoryCS[playerid] != -1)
{
TextDrawBackgroundColor(InventoryCell[playerid][InventoryCS[playerid]], 877223679);
TextDrawHideForPlayer(playerid, InventoryCell[playerid][InventoryCS[playerid]]);
}
InventoryCS[playerid] = -1;
InventoryShow[playerid] = false;
return 1;
}
forward OnPlayerItem(playerid, itemid);
forward OnPlayerDropItem(playerid, itemid);
public OnPlayerItem(playerid, itemid)
{
return 1;
}
public OnPlayerDropItem(playerid, itemid)
{
return 1;
}