Error: Unmatched tilde?
#1

Hi.

I have this error instead of my textdraws. My code:

Код:
                        new str[64], vmsek[2], vmzero[1];
			if(VM[i][VMLaikas]-floatround(VM[i][VMLaikas]/60, floatround_floor)*60 < 10)
			{
			   format(vmzero, 1, "0");
			}
			format(vmsek, 2, "%s%i", vmzero, VM[i][VMLaikas]-floatround(VM[i][VMLaikas]/60, floatround_floor)*60);
			format(str, 64, "Checkpoints:           0%i/10~n~Warnings:                 %i/3~n~Time:                  0%i:%s", VM[i][VMCP], VM[i][VMIsp], floatround(VM[i][VMLaikas]/60, floatround_floor), vmsek);
			PlayerTextDrawSetString(i, VMTDInfo[i], str);
As you can see, ~ symbols are placed correct, but error is still showing.
Reply
#2

you have formatted your string 64 cells only , while it should be 94 cells.
increase the size of the str to 100 atleast.
more explain,
when you used 64 bit
it formatted only:
pawn Код:
"Checkpoints:           0%i/10~n~Warnings:                 %i/3~n //" look here, missing '~' cuz of small string size
That leaded to an error.
Reply
#3

I have sometimes come across this issue when I place a character than often represents another 'shortcut'.

Valid shortcuts are:
Код:
~w~ = white
~r~ = red
~g~ = green
~l~ = black
~y~ = yellow
~p~ = pink
~b~ = blue
~n~ = new line
~h~ = lighter color
~k~ = key mapping
So if I do:
pawn Код:
~n~What?
It will normally think that I am trying to do:
pawn Код:
~w~hat?
and will give me an unmatched tilde error. So what I suggest you do, is leave a space between letters that often represent other codes, like so:

pawn Код:
format(str, 64, "Checkpoints:           0%i/10~n~ Warnings:                 %i/3~n~ Time:                  0%i:%s", VM[i][VMCP], VM[i][VMIsp], floatround(VM[i][VMLaikas]/60, floatround_floor), vmsek);
pawn Код:
new str[110], vmsek[4], vmzero;
    if((VM[i][VMLaikas] - floatround(VM[i][VMLaikas] / 60, floatround_floor) * 60) < 10) vmzero = 0;
    format(vmsek, sizeof(vmsek), "%d%i", vmzero, (VM[i][VMLaikas] - (floatround(VM[i][VMLaikas] / 60, floatround_floor) * 60)));
    format(str, sizeof(str), "Checkpoints:           0%i/10~n~ Warnings:                 %i/3~n~ Time:                  0%i:%s", VM[i][VMCP], VM[i][VMIsp], floatround(VM[i][VMLaikas] / 60, floatround_floor), vmsek);
    PlayerTextDrawSetString(i, VMTDInfo[i], str);
Reply
#4

Yeah, my bad. Letter counter didn't count empty spaces between words and I got only 60 cells.
Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)