їPero como hago para checkear los 7 slots?
EDIT: Para aclarar, lo que quiero hacer es que al agregar un objeto al inventario, que verifique si el slot 1, 2, 3 ..., estбn libres, para asн ordenarse y no tener en el slot 1 tal cosa, el 2 vacнo, el tres vacнo, y el 4 con un arma.
Miren, me puse a pensar y con un poco de ingenio hice esto, їesta bien echo?, el compilador me indica que sн.
pawn Код:
stock ActualizarInventario(playerid, itemid)
{
new inventario[32], text[64], objectotomado;
switch(itemid)
{
case 0:
{
inventario = "Pizza";
objectotomado = 1;
}
case 1:
{
inventario = "Botella de agua";
objectotomado = 2;
}
}
if(IsPlayerConnected(playerid))
{
if(Informacion[playerid][pSlotUsado1] == 0)
{
format(text, sizeof(text), "%s",inventario);
PlayerTextDrawSetString(playerid, Textdraw6[playerid], text);
Informacion[playerid][pSlotUsado1] = 1;
Informacion[playerid][pItem1] = objectotomado;
}
else if(Informacion[playerid][pSlotUsado2] == 0)
{
format(text, sizeof(text), "%s",inventario);
PlayerTextDrawSetString(playerid, Textdraw4[playerid], text);
Informacion[playerid][pSlotUsado2] = 1;
Informacion[playerid][pItem2] = objectotomado;
}
else if(Informacion[playerid][pSlotUsado3] == 0)
{
format(text, sizeof(text), "%s",inventario);
PlayerTextDrawSetString(playerid, Textdraw5[playerid], text);
Informacion[playerid][pSlotUsado3] = 1;
Informacion[playerid][pItem3] = objectotomado;
}
else if(Informacion[playerid][pSlotUsado4] == 0)
{
format(text, sizeof(text), "%s",inventario);
PlayerTextDrawSetString(playerid, Textdraw7[playerid], text);
Informacion[playerid][pSlotUsado4] = 1;
Informacion[playerid][pItem4] = objectotomado;
}
else if(Informacion[playerid][pSlotUsado5] == 0)
{
format(text, sizeof(text), "%s",inventario);
PlayerTextDrawSetString(playerid, Textdraw8[playerid], text);
Informacion[playerid][pSlotUsado5] = 1;
Informacion[playerid][pItem5] = objectotomado;
}
else if(Informacion[playerid][pSlotUsado6] == 0)
{
format(text, sizeof(text), "%s",inventario);
PlayerTextDrawSetString(playerid, Textdraw9[playerid], text);
Informacion[playerid][pSlotUsado6] = 1;
Informacion[playerid][pItem6] = objectotomado;
}
else if(Informacion[playerid][pSlotUsado7] == 0)
{
format(text, sizeof(text), "%s",inventario);
PlayerTextDrawSetString(playerid, Textdraw10[playerid], text);
Informacion[playerid][pSlotUsado7] = 1;
Informacion[playerid][pItem7] = objectotomado;
}
}
return 1;
}