16/07/2024 09:43
(15/07/2024 15:09)Vel Escreveu:Código PHP:new gPlayerListedItems[MAX_PLAYERS][MAX_OBJECTS],
gPlayerListedItemsCount[MAX_PLAYERS];
CMD:itens(playerid) {
new Float: x,
Float: y,
Float: z,
items[MAX_OBJECTS],
list[1024];
GetPlayerPos(playerid, x, y, z);
gPlayerListedItemsCount[playerid] = 0;
for (new i, count = Streamer_GetNearbyItems(x, y, z, STREAMER_TYPE_OBJECT, items, .range = 3.0); i < count; i++) {
new itemid = items[i];
for (new j; j < MAX_OBJECTS; j++) {
if (DropItemSlot[j][DropItem] == itemid) {
format(list, sizeof(list), "%s\n%d\t%s", list, gPlayerListedItemsCount[playerid] + 1, ItemNomeInv(DropItemSlot[j][DropItemID]));
gPlayerListedItems[playerid][gPlayerListedItemsCount[playerid]++] = j;
break;
}
}
}
if (!gPlayerListedItemsCount[playerid]) {
SendClientMessage(playerid, -1, "Não há itens perto de você.");
return 1;
}
ShowPlayerDialog(playerid, 77935, DIALOG_STYLE_LIST, "Itens próximos", list, "Pegar", "Fechar");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
if (dialogid == 77935) {
if (!response) {
return 1;
}
new slot = gPlayerListedItems[playerid][listitem];
if (!CheckInventario(playerid, DropItemSlot[slot][DropItemID])) return SendClientMessage(playerid, COLOR_VERM, "[!] {FFFFFF}Sua mochila esta cheia.");
GanharItem(playerid, DropItemSlot[slot][DropItemID], DropItemSlot[slot][DropItemUni]);
format(str, 64, "{C2A2DA}*%s pegou um(a) %s do chao.", pName(playerid), ItemNomeInv(DropItemSlot[slot][DropItemID]));
ProxDetectorSilva(playerid, 12.0, 0xD7D7D7FF, str);
DestroyDynamicObject(DropItemSlot[slot][DropItem]);
DestroyDynamic3DTextLabel(DropItemSlot[slot][LabelItem]);
DropItemSlot[slot][DropItem] = 0;
DropItemSlot[slot][DropItemID] = -1;
DropItemSlot[slot][DropItemUni] = 0;
DropItemSlot[slot][Interior] = 0;
DropItemSlot[slot][Virtual] = 0;
ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.1, 0, 0, 0, 0, 0, 1);
}
return 1;
}
Obrigado. Terei que atualizar o streamer. Otimo código.
Vou estudar e implementar a meu gosto, muito obrigado. +rep
Programador pawn nível iniciante