05.01.2011, 01:31
i have a problem with /mybag command, when i type it, it should be saying the name of the Item, however, no matter what item i put in the slot, when i type /mybag it says slot:1 mybag when it should say slot:1 [itemname].
pawn Код:
#define MAX_ITEMS 10
#define BAGCOUNT 5
#define EMPTY_BAGSPACE -1
#define ecard 1
#define smedal 2
#define gmedal 3
#define mayorsig 4
#define swatsig 5
#define sdoc1 6
#define sdoc2 7
#define sdoc3 8
#define sdoc4 9
#define sdocfull 10
new Bags[MAX_PLAYERS][BAGCOUNT];
new ItemNames[MAX_ITEMS][32] =
{
{"Electing Card"},
{"Silver Medal"},
{"Gold Medal"},
{"Mayor Signature"},
{"Swat Signature"},
{"Secret Document 1"},
{"Secret Document 2"},
{"Secret Document 3"},
{"Secret Document 4"},
{"Secret Document Full"}
};
pawn Код:
dcmd_mybag(playerid, params[])
{
#pragma unused params
new bagitem[128], bagitem2[128], bagitem3[128], bagitem4[128], bagitem5[128];
SendClientMessage(playerid, COLOR_YELLOW, "-----------------------------------------------");
SendClientMessage(playerid, COLOR_YELLOW, " Your Bag");
SendClientMessage(playerid, COLOR_YELLOW, "-----------------------------------------------");
for (new i = 0; i < BAGCOUNT; i++)
{
if (Bags[playerid][0] == EMPTY_BAGSPACE) format(bagitem, sizeof(bagitem), "Slot:1 ", i + 1);
else format(bagitem, sizeof(bagitem), "Slot:1 %s", i + 1, ItemNames[Bags[playerid][i] - 1]);
SendClientMessage(playerid, COLOR_WHITE, bagitem);
if (Bags[playerid][1] == EMPTY_BAGSPACE) format(bagitem2, sizeof(bagitem2), "Slot:2 ", i + 1);
else format(bagitem2, sizeof(bagitem2), "Slot:2 %s", i + 1, ItemNames[Bags[playerid][i] - 1]);
SendClientMessage(playerid, COLOR_WHITE, bagitem2);
if (Bags[playerid][2] == EMPTY_BAGSPACE) format(bagitem3, sizeof(bagitem3), "Slot:3 ", i + 1);
else format(bagitem3, sizeof(bagitem3), "Slot:3 %s", i + 1, ItemNames[Bags[playerid][i] - 1]);
SendClientMessage(playerid, COLOR_WHITE, bagitem3);
if (Bags[playerid][3] == EMPTY_BAGSPACE) format(bagitem4, sizeof(bagitem4), "Slot:4 ", i + 1);
else format(bagitem4, sizeof(bagitem4), "Slot:4 %s", i + 1, ItemNames[Bags[playerid][i] - 1]);
SendClientMessage(playerid, COLOR_WHITE, bagitem4);
if (Bags[playerid][4] == EMPTY_BAGSPACE) format(bagitem5, sizeof(bagitem5), "Slot:5 ", i + 1);
else format(bagitem5, sizeof(bagitem5), "Slot:5 %s", i + 1, ItemNames[Bags[playerid][i] - 1]);
SendClientMessage(playerid, COLOR_WHITE, bagitem5);
return 1;
}
SendClientMessage(playerid, COLOR_YELLOW, "-----------------------------------------------");
return 1;
}