AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Wierdness with arrays returning wrong value. (https://forums.alliedmods.net/showthread.php?t=6770)

Trp. Jed 10-13-2004 18:36

Wierdness with arrays returning wrong value.
 
I've defined an array at the top of my code as follows:

Code:
new liveGrens[2] = {0, 0}

And, at the end of the plugin_init, just to be sure (because of this bug) i'm zero it again with:

Code:
liveGrens[0] = 0 liveGrens[1] = 0

Now I've gone through my code and the only operations I do on this array is adding or subtracting one from the value with, for example:

Code:
liveGrens[0] += 1 liveGrens[1] -= 1

Thing is, liveGrens[1] is fine and never has a problem but liveGrens[0] for some reason seems to hold some stupidly high number, for example 1147707392 even after its initialised and before anything is done with it.

I have gone over my code and checked theres no erronious assignment operators instead of comparison ones and it looks fine.

Anyone have any idea what it is?

I can probably code a work around but I'd rather not do it if its something simple to fix that I've overlooked.

Da Bishop 10-13-2004 21:26

try this

Code:
new liveGrens[3] = {0, 0}

and use liveGrens 2 and 1

devicenull 10-13-2004 21:33

Post complete code?

Da Bishop 10-13-2004 21:38

That was gonna be my next suggestion. Kinda hard to tell whats going on with just that. Possibly a loop of some kind. :?

PM 10-14-2004 13:35

Might be a bug in the compiler. Please post the whole code and the compiled file. Thanks.

Trp. Jed 10-14-2004 14:18

OOh Lord, I coded a hack in to fix it now :P

I'll see if I can write something that replicates the error.


All times are GMT -4. The time now is 17:14.

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