SA-MP Forums Archive
Way to list all registered players in a dialog list - 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: Way to list all registered players in a dialog list (/showthread.php?tid=569353)



Way to list all registered players in a dialog list - Darkwood17 - 29.03.2015

Is there any way to make a dialog list which shows every registered player (from scriptfiles/Users)?


Re: Way to list all registered players in a dialog list - Ahmad45123 - 29.03.2015

Quote:
Originally Posted by Darkwood17
Посмотреть сообщение
I want to make a dialog list which shows every registered user (from scriptfiles/Users) to a dialog list and when I click on someone to show for example is he muted.
I don't think there is anyway you can list all files in a folders... so this is impossible.


Re: Way to list all registered players in a dialog list - Abagail - 29.03.2015

You can using a plugin such as:
https://sampforum.blast.hk/showthread.php?tid=92246

Using that plugin you'd want to use something such as dir_list.

However this isn't efficient, and a SQL system is highly recommended for this type-of-situation.


Re: Way to list all registered players in a dialog list - Crayder - 29.03.2015

Quote:
Originally Posted by Ahmad45123
Посмотреть сообщение
I don't think there is anyway you can list all files in a folders... so this is impossible.
Ehmm..?

FileManager
Код:
native dir:dir_open(directory[]);
native dir_close(dir:handle);
native dir_list(dir:handle, storage[], &type, length = sizeof(storage));
EDIT: Perhaps I had this tab open longer than I thought, Abagail beat me to it. Like Abagail said, a SQL system is better than saving user files for each player.


Re: Way to list all registered players in a dialog list - Lordzy - 30.03.2015

It's possible either by using FileManager or y_files plugin, according to y_files method:
pawn Код:
new i = 0, str[32], pathStr[64];
while(ffind("Users/*.ini", str, sizeof(str), i)) //Loop through every files inside "Users" folder having .ini extension.
{
    format(pathStr, sizeof(pathStr), "Users/%s.ini", str); //pathStr now contains the player file path.
}
Though, like others stated, I suggest converting your codes to SQL version. For converting the current data, you can use applications like INI->MySQL converter by gtakillerIV. (Link - https://sampforum.blast.hk/showthread.php?tid=510959)