Change !
#1

Anyone know how to make ZCMD that can change:

pawn Код:
#if BLALALLALA == true

to
pawn Код:
#if BLALALLALA == false


Is it possible?
Reply
#2

Well, you can make a command with ZCMD that then changes the BLALALLALA to false, and then calls the function that #if BLALALLALA is used in.
Reply
#3

Uh, just use regular variables instead of directives? I have no idea what you're trying to do.
Reply
#4

depends on what you want what to use, you can use a boolean that will return a true or a false (zero or one) or you use variables with a value and then you can change the variable and check with a if statement if the variable is between something or exactly something. To make things clear a if thatement is looking like :

pawn Код:
if(var == 1) {
    //do this if it equal to 1
} else {
    //do this part when it is not equal to 1
}
your #if is something different. this can be used to check if your blabla is true so you can simple #define blabla false and than check if it is true. and when it is true you can run a part of a code. With this method it is easy to create configs for you self or something, so using directives is not usefull to switch such things.

If you tell what you want to do with your blabla then we can see what the best suiteable solution is
Reply
#5

pawn Код:
#if KILL == true
SetPlayerHealth(playerid, 0);
#endif
So i wanna make command that can change to this:

pawn Код:
#if KILL == false
SetPlayerHealth(playerid, 0);
#endif
Reply
#6

You can't change a define during runtime.

Use a regular variable.
Reply
#7

Can u give me an example
Reply
#8

It's simple stuff. You shouldn't have a problem doing this with 200+ posts here.

pawn Код:
new
    gKill;

CMD:changekill(playerid)
{
    // admin check
   
    if(gKill == 0)
    {
        gKill = 1;
        SendClientMessage(playerid, -1, "Killing enabled.");
    }
    else
    {
        gKill = 0;
        SendClientMessage(playerid, -1, "Killing disabled.");
    }
    return 1;
}

// I'm not sure where you're putting the code below, so...

if(gKill == 1) SetPlayerHealth(playerid, 0);
else SendClientMessage(playerid, -1, "Killing has been disabled.");
Reply
#9

lol
I know this, nvmind
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)