SA-MP Forums Archive
Taking off or Adding - 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: Taking off or Adding (/showthread.php?tid=112189)



Taking off or Adding - Mechscape - 06.12.2009

-= (Takes off?)
+= (Add)

Код:
PlayerInfo[playerid][pDrugs] -= 100;
But i did sold 100 drugs for 1500 money, and my stats have still 100 drugs?

do i set:

Код:
PlayerInfo[playerid][pDrugs] =- 100;
or

Код:
PlayerInfo[playerid][pDrugs] - 100;
What?


Re: Taking off or Adding - Joe Staff - 06.12.2009

Variable -= Number (Variable - Number)
Variable - Number (Variable - Number, but is not a standalone function ex: Variable2 = Variable - Number)
Variable =- Number (Variable equals negative Number, I don't believe you can do this with variables, ex: Variable2 = -Variable, probably a syntax error)
Same goes with Addition. I'm not sure if multiplying and dividing work, I've never actually tried. 0_o


Re: Taking off or Adding - Malice - 06.12.2009

Tundmatu, you are correct. The error is most likely elsewhere.

a -= b
is
a = a - b


Re: Taking off or Adding - Mechscape - 19.02.2010

Quote:
Originally Posted by Picharelo
-= (Takes off?)
+= (Add)

Код:
PlayerInfo[playerid][pDrugs] -= 100;
But i did sold 100 drugs for 1500 money, and my stats have still 100 drugs?

do i set:

Код:
PlayerInfo[playerid][pDrugs] =- 100;
or

Код:
PlayerInfo[playerid][pDrugs] - 100;
What?
Need still help.

Код:
warning 215: expression has no effect
Код:
error 029: invalid expression, assumed zero
nvm,

Код:
a += b
Код:
a -= b
are correction.