Using --; and ++; with a default number ? - 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: Using --; and ++; with a default number ? (
/showthread.php?tid=386338)
Using --; and ++; with a default number ? -
Black Axe - 20.10.2012
I Wanted to make something like..
--5; for example - instead of Just --; - But I Was wondering about the format ? Help would be appreciated
Re: Using --; and ++; with a default number ? -
Virus. - 20.10.2012
What do u mean
Re: Using --; and ++; with a default number ? -
gtakillerIV - 20.10.2012
Then do "-5". "--" = Decrease by 1.
Ex:
PHP код:
amount-5; // This will decrease "amount" by 5.
PHP код:
amount--; //This will decrease "amount" by 1. It's the same as doing "amount-1;".
Re: Using --; and ++; with a default number ? -
Black Axe - 20.10.2012
Thanks GTA Killer - But , "Amount" is the Variable Name - Right ?
EDIT : Nevermind xD - Repped+
Re: Using --; and ++; with a default number ? -
Black Axe - 20.10.2012
Still can't figure it out xD
This is how it goes :
PlayerInfo[playerid][MyVariable] -20;
- I Want it to subtract 20 of the amount he has.
Re: Using --; and ++; with a default number ? -
Hiddos - 20.10.2012
If you want to add or subtract a value, you need to use it like this:
Код:
var -= 20; // minus 20
var += 34; // plus 34
You can only use -- and ++ for quickly subtracting or adding 1
Re: Using --; and ++; with a default number ? -
Jessyy - 20.10.2012
Код:
PlayerInfo[playerid][MyVariable] -= 20;
equal
Код:
PlayerInfo[playerid][MyVariable] = PlayerInfo[playerid][MyVariable] - 20;
You can read more about it here:
https://sampwiki.blast.hk/wiki/Scripting_Basics#Setting
Re: Using --; and ++; with a default number ? -
gtakillerIV - 20.10.2012
My bad
Thanks Cessil.
Re: Using --; and ++; with a default number ? -
cessil - 20.10.2012
Quote:
Originally Posted by gtakillerIV
That should work, what's wrong with it?
|
please have a basic understanding of scripting before you try to help others
https://sampwiki.blast.hk/wiki/Scripting_Basics#Setting