SA-MP Forums Archive
Help me please - 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 me please (/showthread.php?tid=593339)



Help me please - 123eee123 - 04.11.2015

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...


Re: Help me please - Sellize - 04.11.2015

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



Re: Help me please - IceBilizard - 04.11.2015

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



Re: Help me please - PrO.GameR - 04.11.2015

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


Re: Help me please - 123eee123 - 05.11.2015

Thanks, it work...