To change #define with one command. -
nico005 - 17.05.2009
hello,
It's possible to change, example #define Debug false ==> #define Debug true with one command.
Код:
#define Debug false
if(strcmp(cmd,"/debug",true)==0)
{
if(IsPlayerConnected(playerid))
{
#if Debug == false
#define Debug true
#endif
}
return 1;
}
dont work but its just a example.
thank.
Re: To change #define with one command. -
JaYmE - 17.05.2009
Top of script:
pawn Код:
#define Debug // On
or
// #define Debug // Off
#ifdef Debug
if(strcmp("cmd, "/debug", true) == )
{
// Command in here :D
}
#else
return 0;
Re: To change #define with one command. -
Badger(new) - 17.05.2009
Quote:
|
Originally Posted by JaYmE
Top of script:
pawn Код:
#define Debug // On
or
// #define Debug // Off
#ifdef Debug if(strcmp(cmd, "/debug", true) ==0) { // Command in here :D } #else return 0;
|
you added a " before cmd and you putt == instead of ==0.
I'm not sure that'll work.
Re: To change #define with one command. -
ICECOLDKILLAK8 - 17.05.2009
pawn Код:
if(strcmp(cmd, "/debug", true) == 0)
{
#if Debug == true
#undef Debug
#define Debug false
#else
#undef Debug
#define Debug true
#endif
}
Re: To change #define with one command. -
hazdog - 17.05.2009
or you could just use a bool
Re: To change #define with one command. -
JaYmE - 17.05.2009
Quote:
|
Originally Posted by -The_Badger-
Quote:
|
Originally Posted by JaYmE
Top of script:
pawn Код:
#define Debug // On
or
// #define Debug // Off
#ifdef Debug if(strcmp(cmd, "/debug", true) ==0) { // Command in here :D } #else return 0;
|
you added a " before cmd and you putt == instead of ==0.
I'm not sure that'll work.
|
ooops so i did soz i was in a rush, but if you fix the errors it should work
EDIT: #ifdef should be #if defined soz i was thinking about C++
Re: To change #define with one command. -
nico005 - 17.05.2009
dont work, #define Debug false is never changed.
if i made
#if Debug == false
#undef Debug
#define Debug true
SendClientMessage(playerid, COLOR_WHITE, "open");
#else
#undef Debug
#define Debug false
SendClientMessage(playerid, COLOR_WHITE, "close");
#endif
it's always "open" and nothing.
for test in gm if i puts directly #define Debug true. it work
Re: To change #define with one command. -
Badger(new) - 17.05.2009
why do you need to define it anyway? Couldn't you just do:
if(strcmp(cmd,"/Debug",true)==0)
{
if(debug==0)return debug=1;
return 1;
}
Re: To change #define with one command. -
ICECOLDKILLAK8 - 17.05.2009
Quote:
|
Originally Posted by -The_Badger-
why do you need to define it anyway? Couldn't you just do:
if(strcmp(cmd,"/Debug",true)==0)
{
if(debug==0)return debug=1;
return 1;
}
|
Actually you couldnt do that,
1) Variables are at 0 by default in Pawn so theres no need for the =0,
2) Its new not New,
You could do this if you really wanted to lol
pawn Код:
new _DEBUG;
#define Debug _DEBUG
// Then you could just do
Debug = true;
Debug = false;
Re: To change #define with one command. -
Badger(new) - 17.05.2009
pawn Код:
if(strcmp(cmd,"/Debug",true)==0)
{
if(debug==0)return debug=1;
return 1;
}
ok then. How about now?