samp.directory
← Skripte und Bibliotheken

imshooter/pawn-plus-td-array-data

TextDraw Array Data provides functions for adding, retrieving, and checking extra data in a TextDraw for use elsewhere.

Bibliothek★ 1aktualisiert Jan. 2026Keine LizenzPawn
Auf GitHub öffnen

Dieses Repository hat keine Lizenzdatei. Es ist öffentlich lesbar, aber das allein gibt noch keine Erlaubnis, es weiterzuverwenden.

Im Pawn-Compiler ausprobieren →

Fügt seine Include-Dateien samt der Bibliotheken, von denen es abhängt, dem Pawn-Compiler in deinem Browser hinzu, bereit zum Einbinden in ein Skript.

README.md

Using

Include in your code and begin using the library:

#include <td-array-data>

Functions

  • bool:IsValidTextDrawArrayData(Text:textid)
  • bool:TextDrawHasArrayData(Text:textid)
  • bool:TextDrawSetArrayData(Text:textid, const data[], size = sizeof (data))
  • bool:TextDrawGetArrayData(Text:textid, data[], size = sizeof (data))
  • bool:IsValidPlayerTextDrawArrayData(playerid, PlayerText:textid)
  • bool:PlayerTextDrawHasArrayData(playerid, PlayerText:textid)
  • bool:PlayerTextDrawSetArrayData(playerid, PlayerText:textid, const data[], size = sizeof (data))
  • bool:PlayerTextDrawGetArrayData(playerid, PlayerText:textid, data[], size = sizeof (data))

Example

#define MAX_INVENTORY_SLOTS (50)

enum {
    E_TEXT_DRAW_ARRAY_CELL_INVENTORY
};

static enum _:E_TEXT_DRAW_ARRAY_DATA {
    E_TEXT_DRAW_ARRAY_CELL,
    E_TEXT_DRAW_ARRAY_EXTRA_ID
};

static
    Text:gBoxTextID[MAX_INVENTORY_SLOTS] = { INVALID_TEXT_DRAW, ... }
;

CreateTextDraws() {
    new
        data[E_TEXT_DRAW_ARRAY_DATA]
    ;

    for (new i; i != MAX_INVENTORY_SLOTS; ++i) {
        gBoxTextID[i] = TextDrawCreate(...);
        TextDrawTextSize(...);
        TextDrawColour(...);
        TextDrawFont(gBoxTextID[i], TEXT_DRAW_FONT_SPRITE_DRAW);
        TextDrawSetSelectable(gBoxTextID[i], true);

        data[E_TEXT_DRAW_ARRAY_CELL] = E_TEXT_DRAW_ARRAY_CELL_INVENTORY;
        data[E_TEXT_DRAW_ARRAY_EXTRA_ID] = i;

        TextDrawSetArrayData(gBoxTextID[i], data);
    }
}

public OnPlayerClickTextDraw(playerid, Text:clickedid) {
    if (TextDrawHasArrayData(clickedid)) {
        new
            data[E_TEXT_DRAW_ARRAY_DATA]
        ;

        TextDrawGetArrayData(clickedid, data);

        if (data[E_TEXT_DRAW_ARRAY_CELL] == E_TEXT_DRAW_ARRAY_CELL_INVENTORY) {
            SendClientMessage(playerid, -1, "Extra ID: %i", data[E_TEXT_DRAW_ARRAY_EXTRA_ID]);
        }
    }
    
    return 1;
}

Diese Seite wird aus dem erstellt, was GitHub über das Repository veröffentlicht. samp.directory hostet den Code nicht. Ein Problem mit diesem Eintrag melden

imshooter/pawn-plus-td-array-data: SA-MP Bibliothek | samp.directory