SA-MP Forums Archive
SendClientMessage loop - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SendClientMessage loop (/showthread.php?tid=557853)



SendClientMessage loop - ahmedkoki - 15.01.2015

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;
}



Re: SendClientMessage loop - Ahmad45123 - 15.01.2015

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;
}



Re: SendClientMessage loop - ahmedkoki - 15.01.2015

This worked but it shows in game

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


Re: SendClientMessage loop - Ironboy - 15.01.2015

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);



Re: SendClientMessage loop - Ahmad45123 - 15.01.2015

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;
}



Re: SendClientMessage loop - ahmedkoki - 15.01.2015

nevermind Fixed