There is no difference, the last parameter specifies the minimal amount of arguments, but every command has at least one argument (namely the command name itself), so 0 and 1 will have the same effect. I think.
You should learn how to indent code properly ;)
Code:
#include <amxmodx>
#include <fun>
#include <amxmisc>
#define PLUGIN_NAME "Stack X"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "eXist`"
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
register_concmd("amx_stackall", "stack_all", ADMIN_KICK, "user All Players in the server will be stacked upon the admin.")
}
public stack_all(id,level,cid)
{
if (!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED
new players[32], origin[3], playercount, player, a
get_user_origin(id, origin, 0)
get_players(players, playercount, "a")
for (a=0; a<playercount; a++)
{
player = players[a]
origin[2] += 50
set_user_origin(player, origin)
}
return PLUGIN_HANDLED
}
Your problem was in the loop control structure.
You had:
Code:
for (a=0; a<playercount,a++;)
The program will do this on the for loop:
Code:
for (initializer; condition; increment)
{
loop body
}
1) Execute the initializer
2) Check condition; if it's false, don't continue
3) Execute the loop body
4) Execute the increment part
5) Jump to 2
In your case, it will do this:
1) Execute the initializer: set a to 0
2) Check condition:
Firstly, you'll need to know something about the comma operator:
If you write:
a,b
a will be evaluated first, and the value of the expression will be b, which will be evaluated second
So, you have this condition:
a<playercount,a++
a<playercount will be evaluated first, but it's value gets lost, so it doesn't matter
Then, a++ will be evaluated. The value of the whole a<playercount,a++ expression will be the value of a++ (as it's the right part of the comma operator). a++ increments a, but its value is still a (as opposed to ++a, which increments a, and its value is the already incremented a). So, a will be set to 1, and the value of a++ will be the original a, which is 0, so that the value of a<playercount,a++ will be also 0. 0 means false, so the loop is not continued, because the condition is false. So your loop body is never entered.
When you change it to:
Code:
for (a=0; a<playercount;a++)
it should work :D
__________________