AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Array Get Num From Cvar? (https://forums.alliedmods.net/showthread.php?t=229196)

Blizzard_87 11-03-2013 07:07

Array Get Num From Cvar?
 
is it possible to set the number of global arrays for each player from cvar?
this is prolly completely wrong...

PHP Code:

new g_iArray33 ][ get_pcvar_numg_pCvar ) ]; 

i don't where to start.

simanovich 11-03-2013 09:08

Re: Array Get Num From Cvar?
 
Outside of an function, you cann't use any native

hleV 11-03-2013 09:20

Re: Array Get Num From Cvar?
 
You'll need to use dynamic arrays for that.

PHP Code:

new Array:g_iArray[33];

public 
plugin_cfg()
{
     for (new 
1maxPlayers get_maxplayers(), cvarValue get_pcvar_num(g_pCvar); <= maxPlayersi++)
        
g_iArray[i] = ArrayCreate(cvarValue);


However it all depends on what you're actually doing. It may be better to just hardcode the array size in certain scenarios.


All times are GMT -4. The time now is 23:13.

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