[HELP]Error 027: invalid character constant
#1

Код:
1990 stock UserPath(playerid)
1991 {
1992    new string[128],playername[MAX_PLAYER_NAME];
1993    GetPlayerName(playerid,playername,sizeof(playername));
1994    format(string,sizeof(string),PATH,playername);
1995    return string;
1996 }
I'm getting these errors:

GM.pwn(1994) : error 027: invalid character constant
GM.pwn(1994) : error 027: invalid character constant
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

Any suggestions?
Reply
#2

where did you get that PATH?
Reply
#3

Show your PATH define.Do you have a %c in it instead of %s?
Reply
#4

You can't use a macro (or a defined constant) that way. You could do something such as

Код:
"%s%s", PATH, playername
or (I think, can't exactly remember, I use the first one the 100% of the cases)

Код:
""PATH"%s", playername
Reply
#5

#define PATH "\Users\Owner\GTA San Andreas\Server\scriptfiles\Users\%s.ini"

that's my path
Reply
#6

You actually optimized the code with this
Код:
"%s%s", PATH, playername
Using the define directly is faster.

About the other suggestion>>
He already has a specifier(%s or %c or ...) so he doesn't need an %s at the end.He is mostly having an error with his define.

And why can't it be used directly?
#define PATH "/users/%s.ini"
format(string,sizeof(string),PATH,playername);
Reply
#7

Solved thanks guys
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)