AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Solved]Error Need help (https://forums.alliedmods.net/showthread.php?t=12656)

eXist 04-20-2005 17:24

[Solved]Error Need help
 
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:34: [AMXX] Native error in "set_user_origin" on line 155 (file "StackX.sma").
L 04/20/2005 - 17:17:34: [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 }

xeroblood 04-20-2005 20:58

:shock: WOW! Sorry to say it, but you really need to go study some common programming logic.. like working with Arrays and loops.. then come back and try again.. Just giving you the answer won't help you..

eXist 04-20-2005 21:46

You post is just a waste of space. It doesnt help me get anywhere, it just critizizes me. And its not like i havnt tried to look up the errors and arrays and things. This forum is a last resort, if you cant figure something out you come here, and thats what I'm doing.

eXist 04-21-2005 16:43

I figured out the problem. And it has nothing to do with studing loops and arrays over. Your a complete asshole man, i forgot the a = 0 between loop 1 and 2 and u send me on a goose chase because either 1: You just a dick to people or 2: Your to ignorant to even know what the problem is, and post just to get attention. You shouldn't just degrate people like that xeroblood.

Freecode 04-21-2005 18:09

eXist
xeroblod is more then right. You should learn a few things before scripting.
u didnt even register ur plugin ROFL
in ur whole plugin i only see a few usefull lines. everything else can be rewritten in a much better way using arrays like blood say and especialy for loops

eXist 04-21-2005 18:36

First off freecode, yes I'm a newbie at coding, thats because I'm just starting and doing things the way i know them. Second i have registered my plugin i just didnt paste to save room. Third xeroblood has no right to scorn people just because they're new at something.

xeroblood 04-21-2005 18:46

Quote:

Originally Posted by eXist
I figured out the problem. And it has nothing to do with studing loops and arrays over. Your a complete asshole man, i forgot the a = 0 between loop 1 and 2 and u send me on a goose chase because either 1: You just a dick to people or 2: Your to ignorant to even know what the problem is, and post just to get attention. You shouldn't just degrate people like that xeroblood.

I was not rude in my post, I was simply truthful, and Im sorry if the truth hurts.. But now you are being rude and childish, maybe you have intellectual insecurities or something, I don't know, but the fact remains -- You need to study common programming logic first (don't be offended, every programmer has had to). My post was an attempt to lead you on the right track, but if you insist on staying on the wrong track then it is not my problem..

1: I am not a dick to people, I help as often as I can, but some people simply fail to take advice..
2: I am not ignorant, you are -- your problem is obvious, but you fail to see it.. And I don't need/want attention..

Also, I never degraded you in any way, I was offering advice on what you should focus on learning. You may not find much help here with such an attitude.. These forums are for learning HL-AMXX scripting, not general programming..

Sorry to have offended you, it was not intended.

eXist 04-21-2005 18:58

I know your trying to help but you dont need to start your reply with
Quote:

WOW!
thats the degrating part. I'm sorry if i offended you too and it was wrong what i did but your right, these forums are for help, and thats why i posted.

xeroblood 04-21-2005 19:24

My surprise was meant to indirectly emphasize my point, not to lower your dignity.
I didn't intend for you to interpret it so harshly! :wink:

eXist 04-21-2005 19:28

Yea im sorry too :)


All times are GMT -4. The time now is 09:58.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.