Question defining
#1

Hi,

Just a small question with defining.

Lets say I define this:

#define Build "20"


Then under OnGameModeInit:

new mapname[ 100 ];
format( mapname, sizeof( mapname ), "mapname Build: "#Build"" );
SendRconCommand( mapname );



So whats the correct one?

"#Build"
or
"Build"

Thanks
Reply
#2

You don't have to create a new string, or put quotes in int defines.
pawn Код:
#define Build 20
SendRconCommand("mapname Build: "Build"");
Reply
#3

When I define Build as
#define Build 20

I get these 4 errors:


C:\GTA SAMP - Servers\g\gamemodes\G.pwn(94 : error 001: expected token: "-string end-", but found "-identifier-"
C:\GTA SAMP - Servers\g\gamemodes\G.pwn(94 : warning 215: expression has no effect
C:\GTA SAMP - Servers\g\gamemodes\G.pwn(94 : error 001: expected token: ";", but found "-string-"
C:\GTA SAMP - Servers\g\gamemodes\G.pwn(94 : warning 215: expression has no effect
C:\GTA SAMP - Servers\g\gamemodes\G.pwn(94 : error 001: expected token: ";", but found ")"
C:\GTA SAMP - Servers\g\gamemodes\G.pwn(94 : fatal error 107: too many error messages on one line

When I put quotes, its fine.
Reply
#4

pawn Код:
new str[17];
format(str,sizeof(str), "mapname Build: %d", Build);
SendRconCommand(str);
Reply
#5

Yeah, I guess what way would be the easiest.
So I would remove the brackets on the define, right?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)