SA-MP Forums Archive
Can someone explain this to me? - 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: Can someone explain this to me? (/showthread.php?tid=247053)



Can someone explain this to me? - The Woody - 07.04.2011

I got this. It adds/gives the player 1 exp but how does it work? i dont get it. the ++ probably gives him 1 but how?
how would i make it give him more than 1. i dont get it :/. I would be glad if somebody could explain me how it works

pawn Код:
Player[i][EXP]++;



Re: Can someone explain this to me? - antonio112 - 07.04.2011

++ is used to increase the value by 1 ... if you want to add more than 1, you should do like:
pawn Код:
Player[i][EXP] += X;
, where X = your value. That means it adds X amount to it`s value.


Re: Can someone explain this to me? - The Woody - 07.04.2011

Quote:
Originally Posted by antonio112
Посмотреть сообщение
++ is used to increase the value by 1 ... if you want to add more than 1, you should do like:
pawn Код:
Player[i][EXP] += X;
, where X = your value. That means it adds X amount to it`s value.
Oh i see thank you so much so if i wanted to take some it would just be "-= X"?


Re: Can someone explain this to me? - Mike Garber - 07.04.2011

pawn Код:
// Let's say Player[i][EXP] is 0

Player[i][EXP] // is the same as 0

Player[i][EXP]+ // Is the same as 0+

Player[i][EXP]++ // Is the same as 0+1 or Player[i][EXP]+Player[i][EXP]+1

// So lets say the value is 1 already

Player[i][EXP]++ // Is the same as Player[i][EXP]+Player[i][EXP]+1;



Re: Can someone explain this to me? - The Woody - 07.04.2011

Thanks antonio112 and Mike Garber, it helped me allot