+ To Variable - 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: + To Variable (
/showthread.php?tid=144476)
+ To Variable -
Assyria - 27.04.2010
Hello.
How to add "more" to a variable, example:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == test)
{
testvariable[playerid] = 0; // How to set here so when you enter the pickup,
it adds "+1" to the variable without using "testvariable[playerid] = 1;"
So, if you come in the pickup twice, it sets it to "testvariable[playerid] = 2;", if you come in the pickup three times, it sets it to
testvariable[playerid] = 3;, and so on. So, how to?
}
Regards,
Assyria
Re: + To Variable -
¤Adas¤ - 27.04.2010
You mean this?
variable++;
Re: + To Variable -
saiberfun - 27.04.2010
variable++;
or variable +amount;(example: test = 1 atm "test +3;" and now 4)
Re: + To Variable -
Assyria - 27.04.2010
So, for example, this should work for what I explained
Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == test)
{
testvariable[playerid] = ++;
}
Re: + To Variable -
Jochemd - 27.04.2010
Like this: testvariable[playerid] +1
Re: + To Variable -
DeathOnaStick - 27.04.2010
Quote:
Originally Posted by Assyria
So, for example, this should work for what I explained
Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == test)
{
testvariable[playerid] = ++;
}
|
No. Like this:
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == test)
{
testvariable[playerid]++;
}
Re: + To Variable -
Assyria - 27.04.2010
Ok, thanks for replys and making this clear for me