SA-MP Forums Archive
Show files inside script files folder in game - 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: Show files inside script files folder in game (/showthread.php?tid=557741)



Show files inside script files folder in game - ahmedkoki - 14.01.2015

Hello, I want a plugin or something to show or list the .ini files inside scriptfiles when I type a command


Re: Show files inside script files folder in game - PowerPC603 - 14.01.2015

https://sampforum.blast.hk/showthread.php?tid=92246


Re: Show files inside script files folder in game - ahmedkoki - 14.01.2015

That worked thanks but I need to use it without .ini so it doesn't show .ini just the file name


Re: Show files inside script files folder in game - Abagail - 14.01.2015

You can remove the "ini" from the string using strdel, or by using common functions(user-made) such as strreplace.

https://sampforum.blast.hk/showthread.php?tid=85697 may help you.


Re: Show files inside script files folder in game - ahmedkoki - 14.01.2015

Ok but the file manager returns only one file but I want it to return all existing files


Re: Show files inside script files folder in game - ahmedkoki - 15.01.2015

How to loop this so it lists all files inside the folder?

pawn Code:
CMD:listfactions(playerid, params[])
{
    new dir:dHandle = dir_open("./scriptfiles/Groups/");
    new item[40], type, string[128];
       
    while(dir_list(dHandle, item, type))
    {
        strdel(item, strfind(item, ".ini"), strlen(item));
        format(string, sizeof(string), "Files: %s.", item);
        if(type == 2) return SendClientMessage(playerid, -1, string);
    }  
    dir_close(dHandle);
    return 1;
}