SA-MP Forums Archive
[HELP]Error 027: invalid character constant - 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: [HELP]Error 027: invalid character constant (/showthread.php?tid=497400)



[HELP]Error 027: invalid character constant - OllyBrock - 26.02.2014

Код:
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?


Re: [HELP]Error 027: invalid character constant - TheFlyer - 26.02.2014

where did you get that PATH?


Re: [HELP]Error 027: invalid character constant - Yashas - 26.02.2014

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


Respuesta: [HELP]Error 027: invalid character constant - CuervO - 26.02.2014

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



Re: [HELP]Error 027: invalid character constant - OllyBrock - 26.02.2014

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

that's my path


Re: [HELP]Error 027: invalid character constant - Yashas - 26.02.2014

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);


Re: [HELP]Error 027: invalid character constant - OllyBrock - 26.02.2014

Solved thanks guys