loop help
#1

Hey guys, so this loop below loops 10 slots and checks if any is empty. When it is empty it won't send a message, however to be user friendly I want to be able to send a message that the player doesn't have an empty slot. So the codes are:

This code always sends the message even if I have an empty slot, without the else return it works fine but without a message.
pawn Код:
for(new x = 0; x <10; x++)
    {
        if(PlayerInventory[playerid][piSlot][x] == 0)
        {
            if(gunid == 1)
            {
                if(PlayerInfo[playerid][pMaterials] < 1000) return SendClientMessage(playerid,COLOR_GREY,"** You don't have enough materials. **");
                format(string,sizeof(string),"** {C2A2DA}%s creates a Desert Eagle out of materials. {FF8000}**",GPN(playerid));
                SendRadiusMessage(30,playerid,string,COLOR_ORANGE);
                SendClientMessage(playerid,COLOR_GREY,"** The gun is now in your inventory. **");
                PlayerInventory[playerid][piSlot][x] = 348;
                break;
            }
          }
          else return SendClientMessage(playerid,COLOR_GREY,"You don't have an empty slot.");
     }
Reply


Messages In This Thread
loop help - by TonyII - 16.01.2015, 19:30
Re: loop help - by HazardouS - 16.01.2015, 19:44
Re: loop help - by TonyII - 16.01.2015, 19:45

Forum Jump:


Users browsing this thread: 1 Guest(s)