Format a variable++?
#1

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
Reply
#2

new var;

var += increase val;
Reply
#3

Quote:
Originally Posted by ReVo_
Посмотреть сообщение
new var;

var += increase val;
How does the script know to increase the variable by X amount though?
Reply
#4

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)
Reply
#5

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+
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)