View Full Version : Question defining
FreshRio
01/01/2012, 11:01 AM
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
FireCat
01/01/2012, 11:42 AM
You don't have to create a new string, or put quotes in int defines.
#define Build 20
SendRconCommand("mapname Build: "Build"");
FreshRio
02/01/2012, 04:40 AM
When I define Build as
#define Build 20
I get these 4 errors:
C:\GTA SAMP - Servers\g\gamemodes\G.pwn(948) : error 001: expected token: "-string end-", but found "-identifier-"
C:\GTA SAMP - Servers\g\gamemodes\G.pwn(948) : warning 215: expression has no effect
C:\GTA SAMP - Servers\g\gamemodes\G.pwn(948) : error 001: expected token: ";", but found "-string-"
C:\GTA SAMP - Servers\g\gamemodes\G.pwn(948) : warning 215: expression has no effect
C:\GTA SAMP - Servers\g\gamemodes\G.pwn(948) : error 001: expected token: ";", but found ")"
C:\GTA SAMP - Servers\g\gamemodes\G.pwn(948) : fatal error 107: too many error messages on one line
When I put quotes, its fine.
[ABK]Antonio
02/01/2012, 04:43 AM
new str[17];
format(str,sizeof(str), "mapname Build: %d", Build);
SendRconCommand(str);
FreshRio
02/01/2012, 04:56 AM
Yeah, I guess what way would be the easiest.
So I would remove the brackets on the define, right?
vBulletin® v3.8.6, Copyright ©2000-2019, Jelsoft Enterprises Ltd.