Whats with index out of bounds in my array!
I don't get it... its like impossible for this line of code to be out of bounds...
fakecivorigin[0] = fakecivX[npcid]; Code:
|
*Bump*
Also, there are some arrays with [18] so I could expand later easier. |
apparently no one can figure this out, or is this code just acting ghey?
|
Perhaps you should check if it's out of bounds before hand (>=14, not == 14)
|
great... it is >= 14, but how?
|
Did you try what BAILOPAN said anyway? How do you call the function? Do you call it multiple times? At what point do you change the npcid variable?
|
that post said hold on... but u posted anyway...
Yes i did, it is >= to 14. I called it by typing spawnthemmofos in console, using register_clcmd. I am calling it multiple times because I havent made a set_task function yet (to avoid the ed_alloc error.) When i do the command 15 times, then it should start saying its >= to 14. npcid gets changed ocne it spawns the first civ. It should spawn the first civ because it is declared as 0, and I'm pretty sure that arrays have a slot of [0]. edit: im now using npcid++ instead of npcid = npcid + 1, if that makes a difference. |
OMG!!!!!!!! I made the plugin assign npcid to = 0 in 2 different locations, so it was impossible to be anythign but 0... but when i made a client_print to tell me what npcid was, it said it was 108. (The client_print that told me the npcid was in if npcid >=0, the locatiosn where i assigned it to = 0 was when it was declared, and inside the plugin_init. )
edit: sry for all the multiple posting, but every post i make has some other thing i found out... :!: :!: Edit: Edit: i changed the name from npcid to omgwtf to make sure npcid wasnt some other varible somehow... its still 108. |
You're doing crazy stuff like this:
Code:
You've created an array with 14 slots. Then in slot i, you're trying to store a 64cell length string in. A string is an array, and you can't do this. new fakecivphrase[14][64] would work, but that's an expensive operation, and I have no idea what you're trying to do. Anyway, the code you have is riddled with things like this that will overflow the stack and give random values all over the place. |
well, i really diddnt know what the second [] was for after the arrayname[14][64], now it puts everything into perspective... it works now, its just that now its trying to precache mmmodels/barry.mdl. Gotta find out where it gets those mm's.
|
| All times are GMT -4. The time now is 19:27. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.