help with ++ - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: help with ++ (
/showthread.php?tid=251256)
help with ++ -
omer5198 - 26.04.2011
i saw alot of times stuff like this... (Var is an example
can someone plz explain what does it do?
Re: help with ++ -
xDeadlyBoy - 26.04.2011
it does this:
pawn Код:
Var[playerid] = Var[playerid] + 1;
a.k.a. adds 1 to the value.
Re: help with ++ -
omer5198 - 26.04.2011
Quote:
Originally Posted by xDeadlyBoy
it does this:
pawn Код:
Var[playerid] = Var[playerid] + 1;
a.k.a. adds 1 to the value.
|
so can i just do Var[playerid] += 1;
??
Re: help with ++ -
xDeadlyBoy - 26.04.2011
or you can do Var[playerid]++;
it's all the same.
Re: help with ++ -
omer5198 - 26.04.2011
Quote:
Originally Posted by xDeadlyBoy
or you can do Var[playerid]++;
it's all the same.
|
ok... thx!
Re: help with ++ -
Sinner - 26.04.2011
Ther are more, should you care:
PHP код:
Var = Var + 1; // Variable + 1 (add)
Var++; // Variable + 1
Var += 1; // Variable + 1
Var = Var - 1; // Variable - 1; (substract)
Var--; // Variable - 1;
Var -= 1; // Variable - 1;
Var = Var * 1; // Variable * 1; (multiply)
Var *= 1; // Variable * 1;
Var = Var / 1; // Variable / 1; (divide)
Var /= 1; // Variable / 1;
Var = Var & 1; // Variable with bitwise "and" (concatenate 1 bit)
Var &= 1; // with bitwise "and"
Var = Var | 1; // Variable with bitwise "or" (concatenate 1 bit)
Var |= 1; // with bitwise "or"
Hope that helps.