SA-MP Forums Archive
Whats Wrong ? - 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: Whats Wrong ? (/showthread.php?tid=613039)



Whats Wrong ? - ThatFag - 23.07.2016

Код:
new watsnew[ 900 ];
   \n{1cd8ea}==============================================================\n");
	format(watsnew,sizeof(watsnew), " \n {3696EB}Members online:{FFFFFF}%d  \n",c);
     format(watsnew,sizeof(watsnew), " \n {3696EB}Members:{FFFFFF}%d \n",dini_Int(tmpf, "factionmembers"));
	format(watsnew,sizeof(watsnew), "\n{3696EB}Gun Stock:{FFFFFF}%d \n",dini_Int(tmpf, "factionguns"));
	format(watsnew,sizeof(watsnew), "\nStock Status:{FFFFFF}%s\n",wat);
	format(watsnew,sizeof(watsnew), "\n{1cd8ea}==============================================================\n");
format(info2,sizeof(info2),"%s Faction Informations",PlayerInfo[playerid][PTeamName]);
	ShowPlayerDialog(playerid,3000,DIALOG_STYLE_MSGBOX,info2,watsnew,"Close","");
Its showing only the ===== on dialog
its meant to show whole one but idk what is wrong the script is complied and no errors or anything please give me a hand


Re: Whats Wrong ? - Luicy. - 23.07.2016

Can you even compile this?

PHP код:
new watsnew900 ];
   
strcat(watsnew"{1cd8ea}==============================================================\n");
    
strcat(watsnew" \n {3696EB}Members online:{FFFFFF}%d  \n",c);
     
strcat(watsnew" \n {3696EB}Members:{FFFFFF}%d \n",dini_Int(tmpf"factionmembers"));
    
strcat(watsnew"\n{3696EB}Gun Stock:{FFFFFF}%d \n",dini_Int(tmpf"factionguns"));
    
strcat(watsnew"\nStock Status:{FFFFFF}%s\n",wat);
    
strcat(watsnewstrcat(watsnew"\n{1cd8ea}==============================================================\n");
format(info2,sizeof(info2),"%s Faction Informations",PlayerInfo[playerid][PTeamName]);
    
ShowPlayerDialog(playerid,3000,DIALOG_STYLE_MSGBOX,info2,watsnew,"Close",""); 



Re: Whats Wrong ? - ThatFag - 24.07.2016

I've already tried that but it gives me some errors.
I checked some other posts that had same problem and they solved it by using format but at me aint working


Re: Whats Wrong ? - JustMe.77 - 24.07.2016

Quote:
Originally Posted by ThatFag
Посмотреть сообщение
I've already tried that but it gives me some errors.
I checked some other posts that had same problem and they solved it by using format but at me aint working
How are we supposed to help you without that you show us what Errors you get?


Re: Whats Wrong ? - Vince - 24.07.2016

The format() function erases the string and the dialog is showing the last line, not the first. The original string needs to be formatted in as well, or you can use a temporary variable and then concatenate that to the output string. I prefer the latter option because it's clearer, albeit it probably slightly slower.


Re: Whats Wrong ? - ThatFag - 24.07.2016

What you mean by "original string" ?
can you give me an example , im kinda new to strings and dialog.


Re: Whats Wrong ? - K0P - 24.07.2016

forexample you format this string:

Код:
format(string, sizeof(string), "Hello\n");
After that you format another string in the same variable:

Код:
format(string, sizeof(string), "Its me K0P");
Actually what it will do is replace "Its me K0P" with "Hello"

If you want to join 2 or more strings,use strcat(); function


Re: Whats Wrong ? - Konstantinos - 24.07.2016

pawn Код:
new watsnew[320] = "\n{1cd8ea}==============================================================\n" \
    "\n {3696EB}Members online:{FFFFFF}%d\n\n {3696EB}Members:{FFFFFF}%d\n" \
    "\n{3696EB}Gun Stock:{FFFFFF}%d\n\nStock Status:{FFFFFF}%s\n" \
    "\n{1cd8ea}==============================================================\n";
format(watsnew, sizeof watsnew, watsnew, c, dini_Int(tmpf, "factionmembers"), dini_Int(tmpf, "factionguns"), wat);



Re: Whats Wrong ? - ThatFag - 24.07.2016

Thanks Konstantinos it worked
Thanks others for your opinions .
Repped +