Help me please
#1

Hello guys, I'm newbie. I want ask "how to change #define value?"

Exams:
Код:
/#define DAILY true
I want change it to false. How i can?

Код:
cmd:change(playerid)
{
#if DAILY true
DAILY = false; //Not work...
#endif
return 1;
}
Please help me. Thanks!
P/s: My English so bad...
Reply
#2

To use variables in that way you should not use defines, because they cannot be reassigned values.
Instead use regular bools.

PHP код:
new bool:DAILY true;

// Later on, to reassign a value
DAILY false
Reply
#3

try this

at top of script

pawn Код:
new bool:DAILY = false;
then

pawn Код:
cmd:change(playerid)
{
            if(DAILY == false)
            {
                DAILY = true;
            }
            else
            {
                 DAILY = false;
            }
            return 1;
}
Reply
#4

Defines are simply a text that get replaced by the second one, they are not variables to be changed
Reply
#5

Thanks, it work...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)