[y_commands] /commands loop..
#1

Hi again. I ask a question here which is about loops.

I got this loop:
pawn Код:
for (new i = 0; i != count; ++i)
    {
        format(string,sizeof(string),"/%s",Command_GetNext(i, playerid));
        SendInfoMessage(playerid, string);
    }
Which adds up all commands in a list like this:
Код:
/commands
/help
/admins
and so on.

What I want is to make the loop count +5 everytime it finishes.
So that I can change the command format to:
pawn Код:
for (new i = 0; i != count; ++i)
    {
        format(string,sizeof(string),"/%s /%s /%s /%s /%s",Command_GetNext(i, playerid),Command_GetNext(i+1, playerid),Command_GetNext(i+2, playerid),Command_GetNext(i+3, playerid),Command_GetNext(i+4, playerid));
        SendInfoMessage(playerid, string);
    }
Any help is accepted.

EDIT: Also, how do I check if the "Command_GetNext" returns nothing, so that I don't end up with:
pawn Код:
/help /commands / / /
if there's only 2 commands available.
Reply


Messages In This Thread
[y_commands] /commands loop.. - by introzen - 29.06.2013, 07:43
Re: [y_commands] /commands loop.. - by introzen - 29.06.2013, 10:27
Re: [y_commands] /commands loop.. - by IstuntmanI - 29.06.2013, 10:29
Re: [y_commands] /commands loop.. - by introzen - 29.06.2013, 10:41
Re: [y_commands] /commands loop.. - by introzen - 30.06.2013, 16:01
Re: [y_commands] /commands loop.. - by introzen - 30.06.2013, 16:14
Re: [y_commands] /commands loop.. - by introzen - 30.06.2013, 16:36
Re: [y_commands] /commands loop.. - by introzen - 30.06.2013, 16:44
Re: [y_commands] /commands loop.. - by introzen - 30.06.2013, 17:04

Forum Jump:


Users browsing this thread: 2 Guest(s)