AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   dynamic allocated arrays possible? (https://forums.alliedmods.net/showthread.php?t=9326)

ripcurl2 01-14-2005 17:15

dynamic allocated arrays possible?
 
another nice problem i have worked myself into :)
here the thing code:
Code:
.... new count = 0 .... count = dbi_field(result, 1) //count becomes the number in the field (about 3000) new iTempArray[count][32]

results in this compiler error:
amxxsc: sc1.c:1727: cell adjust_indirectiontables(int *, int, int, int, int, constvalue *): Assertion `dim[cur]>0' failed.

in essence: the compiler wants a statically assigned array like this:
Code:
new iTempArray[3000][32]

my question:
is there a way to make the compiler swallow dynamic (=size determined @ runtime) allocated arrays? (as done in the first code segment)

BlueRaja 01-14-2005 19:48

small doesn't use dynamic arrays

XxAvalanchexX 01-14-2005 20:03

For this, you will need to use the Array Module, which is a pain in the butt from what I've heard.

ripcurl2 01-14-2005 20:30

no need, found another way to solve this stuff. i kinda dug into sql queries with a l33t coder here. Got some wicked results here a sample :)

Code:
dbi_query(g_dbc,"UPDATE `%s`,`%s` SET `%s`.kills=`%s`.kills+`%s`.kills,`%s`.score=`%s`.score+`%s`.score,`%s`.teamkills=`%s`.teamkills+`%s`.teamkills,`%s`.deaths=`%s`.deaths+`%s`.deaths,`%s`.hits=`%s`.hits+`%s`.hits,`%s`.shots=`%s`.shots+`%s`.shots,`%s`.headshots=`%s`.headshots+`%s`.headshots where `%s`.authid=`%s`.authid",dst,src,dst,dst,src,dst,dst,src,dst,dst,src,dst,dst,src,dst,dst,src,dst,dst,src,dst,dst,src,dst,src)
and more of course :), but this one was the master of confusion. If you look at it too long, you see a purple wizzard shooting fireballs at you from the left.


have fun decoding that


All times are GMT -4. The time now is 19:28.

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