SA-MP Forums Archive
Increase variable by 1? - 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: Increase variable by 1? (/showthread.php?tid=109295)



Increase variable by 1? - hipy - 19.11.2009

If I make a variable called poop = 0
how can I make this number to increase by 1(+1)

thanks


Re: Increase variable by 1? - Correlli - 19.11.2009

pawn Код:
poop++;
or
pawn Код:
poop += 1;
or
pawn Код:
poop = poop + 1;



Re: Increase variable by 1? - fanatik - 19.11.2009

These codes increase by 1.
Код:
poop++;
Код:
poop += 1;
Код:
poop = poop+1;
These codes increase by 2.
Код:
poop += 2;
Код:
poop = poop+2;
These codes increase by 3.
Код:
poop += 3;
Код:
poop = poop+3;
These codes decrease by 1.
Код:
poop--;
Код:
poop -= 1;
Код:
poop = poop-1;
These codes decrease by 2.
Код:
poop -= 2;
Код:
poop = poop-2;
These codes decrease by 3.
Код:
poop -= 3;
Код:
poop = poop-3;



Re: Increase variable by 1? - hipy - 19.11.2009

Ty so if I want After a connect let THE number be 1 I have to do on init poop = 0 so the ++ will make it 1?


Re: Increase variable by 1? - fanatik - 19.11.2009

Quote:
Originally Posted by hipy
Ty so if I want After a connect let THE number be 1 I have to do on init poop = 0 so the ++ will make it 1?
Yes.
If you use poop = 15;
++ will make it 16.

16 --> 17
183 --> 184
etc.


Re: Increase variable by 1? - hipy - 19.11.2009

Thanks!!