SA-MP Forums Archive
Change ! - 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: Change ! (/showthread.php?tid=442180)



Change ! - Giroud12 - 06.06.2013

Anyone know how to make ZCMD that can change:

pawn Код:
#if BLALALLALA == true

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


Is it possible?


Re: Change ! - reckst4r - 06.06.2013

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.


Re: Change ! - Vince - 06.06.2013

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


Re: Change ! - jordy.kiesebrink - 06.06.2013

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


Re: Change ! - Giroud12 - 06.06.2013

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



Re: Change ! - Scenario - 06.06.2013

You can't change a define during runtime.

Use a regular variable.


Re: Change ! - Giroud12 - 06.06.2013

Can u give me an example


Re: Change ! - Scenario - 06.06.2013

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.");



Re: Change ! - Giroud12 - 06.06.2013

lol
I know this, nvmind