First ill start by saying my plugin is designed to stack users in a pyramid formation atop the admin. My plugin compiles fine, no errors or warnings. Its weird though when i use it in a game.
Its suppose to stack people like this:
- - - <This guy doesnt show up--
--
- <Admin---
But it keeps leaving out the last man.
Heres the error i get in console:
L 04/20/2005 - 17:17

4: [AMXX] Native error in "set_user_origin" on line 155 (file "StackX.sma").
L 04/20/2005 - 17:17

4: [Fun] Player out of range (0)
I've checked the line that is says, I cant find anything.
Heres the code:
Help is much appriciated thanks eXist
*EDIT* I have debugged the plugin
Code:
//INCLUDES----------------------------------------------------------------------------
#include <amxmodx>
#include <fun>
#include <amxmisc>
#define PLUGIN_NAME "Stack X"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "eXist`"
//MAIN--------------------------------------------------------------------------------
public plugin_init()
{
register_concmd("amx_stackpyramid", "stack_pyramid", ADMIN_KICK, "user Random players will be stacked upon admin in a pyramid formation. There must be more that 5 alive users.")
}
//AMX_STACKPYRAMID--------------------------------------------------------------------
public stack_pyramid(id,level,cid)
{
if (!cmd_access(id,level,cid,1))
{
return PLUGIN_HANDLED
}
new players[32], origin[3], playercount, player1, player2, player3, player4, player5, a, b
get_user_origin(id, origin, 0)
get_players(players, playercount, "a")
while (a<1)
{
player1 = players[random_num(0, playercount-1)]
if(player1 != id)
{
a = 1
}
b++
if(b == 50)
{
console_print(id, "There are not enough users alive or in the server.")
return PLUGIN_HANDLED
}
}
while (a<1)
{
player2 = players[random_num(0, playercount-1)]
if(player1 != player2 && id != player2)
{
a = 1
}
b++
if(b == 100)
{
console_print(id, "There are not enough users alive or in the server.")
return PLUGIN_HANDLED
}
}
a = 0
b = 0
while (a<1)
{
player3 = players[random_num(0, playercount-1)]
if(player1 != player3 && player2 != player3 && id != player3)
{
a=1
}
b++
if(b == 150)
{
console_print(id, "There are not enough users alive or in the server.")
return PLUGIN_HANDLED
}
}
a = 0
b = 0
while (a<1)
{
player4 = players[random_num(0, playercount-1)]
if(player1 != player4 && player2 != player4 && player3 != player4 && id != player4)
{
a=1
}
b++
if(b == 200)
{
console_print(id, "There are not enough users alive or in the server.")
return PLUGIN_HANDLED
}
}
a = 0
b = 0
while (a<1)
{
player5 = players[random_num(0, playercount-1)]
if(player1 != player5 && player2 != player5 && player3 != player5 && player4 != player5 && id != player5)
{
a=1
}
b++
if(b == 250)
{
console_print(id, "There are not enough users alive or in the server.")
return PLUGIN_HANDLED
}
}
origin[1] = origin[1] + 25
origin[2] = origin[2] + 75
set_user_origin(player1, origin)
origin[1] = origin[1] + 25
origin[2] = origin[2] + 75
set_user_origin(player2, origin)
origin[1] = origin[1] - 75
origin[2] = origin[2] - 75
set_user_origin(player3, origin)
origin[1] = origin[1] - 25
origin[2] = origin[2] + 75
set_user_origin(player4, origin)
origin[1] = origin[1] + 50
origin[2] = origin[2] + 0
set_user_origin(player5, origin)
return PLUGIN_HANDLED
}