SA-MP Forums Archive
Dialog and massive help - 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: Dialog and massive help (/showthread.php?tid=397977)



Dialog and massive help - Aftemark - 07.12.2012

Hi everyone! I need to create a table in dialog like that thing:
sry for language on that picture, but as u can see there is a info about gas price on petrol stations over the state. How to create somthing like that using massives, not by typing every single string =/ please help!
There is a part of my code
PHP код:
for(new 0sizeof(mnpBizzInfo); b++)
                {
                    new 
azsinfo[sizeof(mnpBizzInfo)][100];
                    
format(azsinfo[b],sizeof(azsinfo[b]), "ÀÇÑ [¹%d] - Öåíà çà ëèòð $%d",b,azsBizzInfo[b][azsEntranceCost])
                    new 
commmsg[1830];
                    
format(commmsg,sizeof(commmsg), "/n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/n%s",azsinfo[0],azsinfo[1],azsinfo[2],azsinfo[3],azsinfo[4],azsinfo[5],azsinfo[6],azsinfo[7],azsinfo[8],azsinfo[9],azsinfo[10],azsinfo[11],azsinfo[12],azsinfo[13],azsinfo[14],azsinfo[15],azsinfo[16],azsinfo[17],azsinfo[18],azsinfo[19],azsinfo[20]);
                    
ShowPlayerDialog(playerid,63DIALOG_STYLE_MSGBOX,"F.A.Q ïî êàìàíäàì ñåðâåðà"commmsg"Äàëåå""Çàêðûòü");
                } 



Re: Dialog and massive help - Aftemark - 07.12.2012

my script is wrong and there are a bit of errors cos pawn doesnt respond "b" as a massive number in azsinfo[b], how to do it


Re: Dialog and massive help - XStormiest - 07.12.2012

using strcat and format


Re: Dialog and massive help - DaRk_RaiN - 07.12.2012

if you get the error that there are too many characters in one line you can reduce that
Example:
pawn Код:
format(commmsg,sizeof(commmsg), "/n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/"
"n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/"
"n%s\/n%s\/n%s",azsinfo[0],azsinfo[1],azsinfo[2],azsinfo[3],azsinfo[4],azsinfo[5],azsinfo[6],azsinfo[7],azsinfo[8],azsinfo[9],azsinfo[10],azsinfo[11],azsinfo[12],azsinfo[13],azsinfo[14],azsinfo[15],azsinfo[16],azsinfo[17],azsinfo[18],azsinfo[19],azsinfo[20]);



Re: Dialog and massive help - Aftemark - 07.12.2012

Quote:
Originally Posted by XStormiest
Посмотреть сообщение
using strcat and format
can u please give me a tutorial or a part of a code how to use it?


Re: Dialog and massive help - Aftemark - 07.12.2012

Quote:
Originally Posted by DaRk_RaiN
Посмотреть сообщение
if you get the error that there are too many characters in one line you can reduce that
Example:
pawn Код:
format(commmsg,sizeof(commmsg), "/n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/"
"n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/n%s\/"
"n%s\/n%s\/n%s",azsinfo[0],azsinfo[1],azsinfo[2],azsinfo[3],azsinfo[4],azsinfo[5],azsinfo[6],azsinfo[7],azsinfo[8],azsinfo[9],azsinfo[10],azsinfo[11],azsinfo[12],azsinfo[13],azsinfo[14],azsinfo[15],azsinfo[16],azsinfo[17],azsinfo[18],azsinfo[19],azsinfo[20]);
how to reduce it?


Re: Dialog and massive help - XStormiest - 07.12.2012

for example

Код:
   new str[256], string[256], astring[256];
   format(string,sizeof(string),"Here your formated text",here your float or whatever you want)
   format(astring,sizeof(astring),"as above",as above);
   strcat(str,string);
  strcat(str,astring);
     ShowPlayerDialog(playerid,25,DIALOG_STYLE_MSGBOX,"Dialog",str,"Ok","");
but i think you understand what i want to say..


Re: Dialog and massive help - Aftemark - 07.12.2012

thx) strcat combinates both as i get it right?


Re: Dialog and massive help - XStormiest - 07.12.2012

yep combinate that 2 function , and you will do well your script , if you still not understand send me a P.M


Re: Dialog and massive help - Aftemark - 07.12.2012

PHP код:
{
                    if(
== 0)
                    {
                        
format(strazs,sizeof(strazs), "ÀÇÑ [¹%d] - Öåíà çà ëèòð $%d",b,azsBizzInfo[b][azsEntranceCost]);
                    }
                    else if(
== 19)
                        {
                        
ShowPlayerDialog(playerid,63DIALOG_STYLE_MSGBOX,"Ìîíèòîðèíã öåí ÀÇÑ"strazs"""Çàêðûòü");
                    }
                    else
                    {
                        
format(azsinfo,sizeof(azsinfo), "\nÀÇÑ [¹%d] - Öåíà çà ëèòð $%d",b,azsBizzInfo[b][azsEntranceCost]);
                               
strcat(strazs,azsinfo);
                        }
                } 
I did it right?