PDA

View Full Version : case label


Dezzzy
26/01/2015, 05:19 PM
this is code
http://s017.radikal.ru/i432/1501/68/8700d865aed9.png


this is error

C:\Users\Gigi\Desktop\New folder\gamemodes\Fletcher2.pwn(104) : error 040: duplicate "case" label (value 97)
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


1 Error.


rep++

Sledgehammer
26/01/2015, 05:26 PM
Change "Switch" to "while" on line 104.

Dezzzy
26/01/2015, 05:28 PM
dont work..

Nero_3D
26/01/2015, 05:33 PM
I can't even see what is on the case line (copy paste the switch in here)
But the errors just states that you did something like that "case 97, 97" (97 is equivalent with 'a')

Dezzzy
26/01/2015, 05:36 PM
case 'A'..'Я', 'a'..'я', ' ': return ShowPlayerDialog(playerid, 1, DSM, "Shecvale", "shecvle rasklakidebi", "gaimeore", "");


also that switch

switch(inputtext[i])

DRIFT_HUNTER
26/01/2015, 05:59 PM
I dont SEE why its dyplicated but i guess its possible that SPACE character in ASCII table is in between A and YA characters so thats why it say DUPLICATED CASE LABEL 97.

If im right removing ' ' will solve problem, but if im not try using if

if(inputtext[i] >= 'A' && inputtext[i] <= 'Я' ||
inputtext[i] >= 'a' && inputtext[i] <= 'я' || inputtext[i] == ' ') return ShowPlayerDialog(playerid, 1, DSM, "Shecvale", "shecvle rasklakidebi", "gaimeore", "");


Im pretty sure that these is not the best way to validate Russian letters as A belongs to English while YA to Russian and in between there can be some other letters (Arabian, Chinise, Italian...etc...)

Dezzzy
26/01/2015, 06:08 PM
i got warning on this line

inputtext[i] >= 'a' && inputtext[i] <= '' || inputtext[i] == ' ') return SPD(playerid, 1, DSM, "Shecvale" "shecvla rasks", "gaimeore", "");


C:\Users\Gigi\Desktop\New folder\gamemodes\Fletcher2.pwn(103) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.

DRIFT_HUNTER
26/01/2015, 07:00 PM
If im not mistaking its due to loop.

Just add if inside curve brackets

for(new i = sizeof(inputtext)-1; i >= 0; i--)
{
if(inputtext[i] >= 'A' && inputtext[i] <= 'Я' ||
inputtext[i] >= 'a' && inputtext[i] <= 'я' || inputtext[i] == ' ') return ShowPlayerDialog(playerid, 1, DSM, "Shecvale", "shecvle rasklakidebi", "gaimeore", "");
}


EDIT: Im pretty sure your loop will get into overflow at start :P (FOR loop doesn't consider --i, its treated as i--, well at least in C/++ and php as far as i know, so just use what's SAFE :P)

Nero_3D
27/01/2015, 02:30 PM
After a little search I found out that the Cyrillic script also starts with some kind of an A

The problem you have is that you took the latin A and not the cyrillic А

That should be the version with the correct А and а (they look identical to me)
case 'А'..'Я', 'а'..'я', ' ':
You will notice the problem in one of the codepages

http://de.wikipedia.org/wiki/Windows-1251