← Scripts et bibliothèques
imshooter/pawn-plus-td-array-data
TextDraw Array Data provides functions for adding, retrieving, and checking extra data in a TextDraw for use elsewhere.
Bibliothèque★ 1mis à jour janv. 2026Pas de licencePawn
Ouvrir sur GitHubCe dépôt n’a pas de fichier de licence. Il est public en lecture, mais cela ne donne pas à lui seul le droit de le réutiliser.
L’essayer dans le compilateur Pawn →
Ajoute ses fichiers include, avec les bibliothèques dont il dépend, au compilateur Pawn de ton navigateur, prêts à être inclus dans un script.
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;
}
Cette page est construite à partir de ce que GitHub publie sur le dépôt. samp.directory n’héberge pas le code. Signaler un problème avec cette fiche