SendClientMessage loop
#1

Ok I have this but it returns the files like this
Код:
Filename1
Filename2
so I want it to sendclientmessage as
Код:
Filename1 - Filename2
pawn Код:
stock NumFiles(playerid)
{
    new string[50];
    format(string, sizeof(string), "./scriptfiles/Groups/");
   
    new dir:dHandle = dir_open(string);
    new item[40], type, contor = -1;
       
    while(dir_list(dHandle, item, type))
    {
        if(type == FM_FILE)
        {
            strdel(item, strfind(item, ".ini"), strlen(item));
            format(string, sizeof(string), item);
            SendClientMessage(playerid, -1, string);
            contor++;
        }
    }
           
    dir_close(dHandle);
    return 1;
}
Reply
#2

Try this out...

pawn Код:
stock NumFiles(playerid)
{
    new string[50];
    format(string, sizeof(string), "./scriptfiles/Groups/");
   
    new dir:dHandle = dir_open(string);
    new item[40], type, contor = -1;
       
    while(dir_list(dHandle, item, type))
    {
        if(type == FM_FILE)
        {
            new tmpItem[40];
            strdel(item, strfind(item, ".ini"), strlen(item));
            format(tmpItem, sizeof(tmpItem), " - %s", item);
            strcat(string, tmpItem);
            contor++;
        }
    }
   
    SendClientMessage(playerid, -1, string);
    dir_close(dHandle);
    return 1;
}
Reply
#3

This worked but it shows in game

Код:
./scriptfiles/Groups/ - Filename1 - Filename2
I don't want "./scriptfiles/Groups/" to be viewed
Reply
#4

Quote:
Originally Posted by ahmedkoki
Посмотреть сообщение
This worked but it shows in game

Код:
./scriptfiles/Groups/ - Filename1 - Filename2
I don't want "./scriptfiles/Groups/" to be viewed
Remove this from it.

pawn Код:
SendClientMessage(playerid, -1, string);
Reply
#5

Quote:
Originally Posted by ahmedkoki
Посмотреть сообщение
This worked but it shows in game

Код:
./scriptfiles/Groups/ - Filename1 - Filename2
I don't want "./scriptfiles/Groups/" to be viewed
Here:
pawn Код:
stock NumFiles(playerid)
{
    new string[50];
    format(string, sizeof(string), "./scriptfiles/Groups/");
   
    new dir:dHandle = dir_open(string);
    new item[40], type, contor = -1;
       
    new msg[500];
    while(dir_list(dHandle, item, type))
    {
        if(type == FM_FILE)
        {
            new tmpItem[40];
            strdel(item, strfind(item, ".ini"), strlen(item));
            format(tmpItem, sizeof(tmpItem), " - %s", item);
            strcat(msg, tmpItem);
            contor++;
        }
    }
    strdel(msg, 0, 2); //Removes the " - " in the start... :D
    SendClientMessage(playerid, -1, msg);
    dir_close(dHandle);
    return 1;
}
Reply
#6

nevermind Fixed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)