SA-MP Forums Archive
[Help] Order Alphabetic a Dialog - 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: [Help] Order Alphabetic a Dialog (/showthread.php?tid=665114)



[Help] Order Alphabetic a Dialog - bookknp - 22.03.2019

Hello guys, how can I alphabetically order a string on a dialog? thx friends +rep

This is my code:

PHP код:
if(IsPlayerInRangeOfPoint(playerid4.0, -118.4777,-1208.6708,4.5859))//F1
    
{
        if(
PRESSED(KEY_SECONDARY_ATTACK))
        {
        if(
Giocatore[playerid][Costruttore]==1) return SendClientMessage(playerid,ROSSO,"[ERROR:] {FFFFFF}You are in builder mode.");
        
format(stringa,sizeof(stringa),"");
        for(new 
i=0;i<=GareCaricatei++)
         {
         if(
Gara[i][Giri]>&& Gara[i][Inseguimento]==0)
         
format(stringa2,sizeof(stringa2),"{F58C5B}{FFFFFF}%s (%d laps)",Gara[i][Nome],Gara[i][Giri]);
         if(
Gara[i][Giri]==&& Gara[i][Inseguimento]==0)
         
format(stringa2,sizeof(stringa2),"{97EA68}{FFFFFF}%s",Gara[i][Nome]);
         if(
Gara[i][Giri]>&& Gara[i][Inseguimento]==1)
         
format(stringa2,sizeof(stringa2),"{446ED1}{FFFFFF}%s (%d laps)",Gara[i][Nome],Gara[i][Giri]);
         if(
Gara[i][Giri]==&& Gara[i][Inseguimento]==1)
         
format(stringa2,sizeof(stringa2),"{446ED1}{FFFFFF}%s",Gara[i][Nome]);
         
strins(stringa,stringa2,strlen(stringa),sizeof(stringa));
         if(
i!=GareCaricate)
         
strins(stringa,"\nAzukay\nEstoril\nForest\nMonaco\n",strlen(stringa),sizeof(stringa));
         }
        
ShowPlayerDialog(playerid2DIALOG_STYLE_LIST"Circuits",stringa "Select""Cancel");
               return 
1;
    }} 



Re: [Help] Order Alphabetic a Dialog - TheToretto - 22.03.2019

Check out this include: https://github.com/oscar-broman/md-sort


Re: [Help] Order Alphabetic a Dialog - bookknp - 22.03.2019

Quote:
Originally Posted by TheToretto
Посмотреть сообщение
Very thx friend. i got it, but i dont know the way use it alphabetly, could you help me?


Re: [Help] Order Alphabetic a Dialog - antixgaming - 22.03.2019

Sort the strings (only if you have strings not single string) and sort them out from lowest argument to highest argument (ASCII chars and indexes).


Re: [Help] Order Alphabetic a Dialog - bookknp - 22.03.2019

Quote:
Originally Posted by antixgaming
Посмотреть сообщение
Sort the strings (only if you have strings not single string) and sort them out from lowest argument to highest argument (ASCII chars and indexes).
antixgaming if you look at it is a creation of circuits and what I try is to alphabetize them every time a new one is created. Thanks for answering but I still do not know how to do it ¿¿??