To check if a slot is available?
#1

Hello,

How to check if a slot is available and if there are none available, how to tell? Using Loop, for example:

pawn Код:
new string[64];
for(new i = 0; i < 5; ++i)
{
    if(Avail[i] == 1)
    {
        format(string, sizeof(string), "SLOT %d IS AVAILABLE", i);
        SCM(playerid, COLOR_WHITE, string);
        break;
    }
    else
    {
        SCM(playerid, COLOR_WHITE, "THERE IS NO MORE SLOT AVAILABLE");
    }
}
Reply
#2

pawn Код:
new lsString[64], liSlot = -1;
for(new i = 0; i < 5; ++i)
{
    if(Avail[i] == 1)
    {
        liSlot = i;
        break;
    }
}

if(liSlot != -1)
{
    format(lsString, 64, "SLOT %d IS BEING USED", liSlot);
    SCM(playerid, COLOR_WHITE, lsString);
}
else
{
    SCM(playerid, COLOR_WHITE, "There's no slot available");
}
Reply
#3

mmkay Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)