SA-MP Forums Archive
A problem with MSG box. - 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: A problem with MSG box. (/showthread.php?tid=399409)



A problem with MSG box. - Gennum. - 14.12.2012

Hey,
I'm trying to create a MDC system for the PD (Roleplay Sever), well the problem is when I want to see the criminal record, it doesn't read all the records, I think the problem is that it doesn't save right the string, look at that:

Код:
				    new playername[24];
	  				if(!strlen(inputtext)) return SendClientMessage(playerid,0xFF000000,"[ERROR]: You should to type a criminial record.");
					GetPlayerName(MDCTarget[playerid],playername,24);
	   				format(string, sizeof(string), "CRecords/%s.cfg", playername);
					new File:filee = fopen(string, io_append);
					new stringg[1300];
					new Year, Month, Day;
					getdate(Year, Month, Day);
					format(stringg, sizeof(stringg), "%s(%d/%d/%d)\n",inputtext, Day, Month,Year);
					fwrite(filee, stringg);
					fclose(filee);
and how it looks into the file:

Код:
Check1(14/12/2012) Check2(14/12/2012)



Re: A problem with MSG box. - LarzI - 14.12.2012

Quote:
Originally Posted by Gennum.
Посмотреть сообщение
Код:
new stringg[1300];
Holy mother of God, that's a huge amount of cells. Are you sure you need to use as many as 1300?


Re: A problem with MSG box. - Gennum. - 14.12.2012

Quote:
Originally Posted by LarzI
Посмотреть сообщение
Holy mother of God, that's a huge amount of cells. Are you sure you need to use as many as 1300?
Listen, I use this amount of cells bacuse when you want to see in a clinetmessage the criminal records you see all the criminal records, it can take even more than.


Re: A problem with MSG box. - LarzI - 14.12.2012

Quote:
Originally Posted by Gennum.
Посмотреть сообщение
Listen, I use this amount of cells bacuse when you want to see in a clinetmessage the criminal records you see all the criminal records, it can take even more than.
Chat messages (Client messages) can't be longer than 128. You're wasting (1300 - 128 =) 1172 cells.


Re: A problem with MSG box. - Gennum. - 14.12.2012

Alright, but leave it, did you see my problem ?
I really need your help


Re: A problem with MSG box. - LarzI - 14.12.2012

Quote:
Originally Posted by Gennum.
Посмотреть сообщение
Alright, but leave it, did you see my problem ?
I really need your help
Yes, let's leave it for now.

Well no, not really. I don't see anything particularly wrong with the saving. How about you show us how and where you read the files?


Re: A problem with MSG box. - Gennum. - 14.12.2012

Код:
	           					new File:filee = fopen(string, io_read);
								new stringg[1300];
								fread(filee, stringg);
								SendClientMessage(playerid,color_white,stringg);
 								format(string3, sizeof(string3), "{C9C9C9}Full name: {FFFFFF}%s.\n{C9C9C9}Phone Number: {FFFFFF}%d\n{C9C9C9}Driving license: {FFFFFF}%s.\n{C9C9C9}Bike license: {FFFFFF}%s.\n{C9C9C9}Trucker license: {FFFFFF}%s.\n{C9C9C9}Firearm license: {FFFFFF}%s.\n{C9C9C9}Occupation: {FFFFFF}%s.\n{C9C9C9}Rank: {FFFFFF}%s.\n{C9C9C9}Part-time job: {FFFFFF}%s. \nWanted for: %s", playername,PlayerInfo[MDCTarget[playerid]][pPhone],carl,bikel,truckl,wepl,faction,rank,job,stringg);
      							ShowPlayerDialog(playerid,24,DIALOG_STYLE_MSGBOX,"POLICE DATABASE",string3,"Residence","Exit");
								fclose(filee);



Re: A problem with MSG box. - maramizo - 14.12.2012

Use \r\n instead of \n.
edit:
lol the 1300 string again.
Also, what is the error exactly?


Re: A problem with MSG box. - LarzI - 14.12.2012

Hmm. I would try using a while loop on fread to read only one line at a time, but then again showing a dialog with its contents would require many dialogs I think. I'm not entirely sure how you want this to work.


Re: A problem with MSG box. - Gennum. - 14.12.2012

Quote:
Originally Posted by maramizo
Посмотреть сообщение
Use \r\n instead of \n.
edit:
lol the 1300 string again.
Also, what is the error exactly?
Alright, I did it.
Well now the problem is that:

Now it saves it like that:
Код:
BVBVB(14/12/2010)
gfbvb(14/12/2010)
Two lines..

But now the problem is - how to put in into a dialog [MSGBOX].

When I use it how I use it before, now it shows me only one line, the first. BVBVB(14/12/2010)
and I want it to show me all the lines are have written into the file.