Format a 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)
+--- Thread: Format a variable++? (
/showthread.php?tid=398851)
Format a variable++? -
Lz - 11.12.2012
Is it possible to make it so when a command is executed.. For example: /make 2
It will increase the variable by 2, And if they type /make 1, It increases by 1..
If so how would i do so? Thanks
Re: Format a variable++? -
ReVo_ - 11.12.2012
new var;
var += increase val;
Re: Format a variable++? -
Lz - 11.12.2012
Quote:
Originally Posted by ReVo_
new var;
var += increase val;
|
How does the script know to increase the variable by X amount though?
Re: Format a variable++? -
ReVo_ - 11.12.2012
Example:
Код:
new val;
COMMAND:make(playerid, params[])
{
val += strval (params);
printf("new val is: %d", val);
}
everytime you do /make 1 the value of n increases of 1, if you do /make 5 and n is 5, it will increase of 5 (it will become 5+5=10)
Re: Format a variable++? -
Lz - 11.12.2012
Quote:
Originally Posted by ReVo_
Example:
Код:
new val;
COMMAND:make(playerid, params[])
{
val += strval (params);
printf("new val is: %d", val);
}
everytime you do /make 1 the value of n increases of 1, if you do /make 5 and n is 5, it will increase of 5 (it will become 5+5=10)
|
Thanks man, Rep+