Raised This Month: $ Target: $400
 0% 

Array Get Num From Cvar?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 11-03-2013 , 07:07   Array Get Num From Cvar?
Reply With Quote #1

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.
__________________
Blizzard_87 is offline
simanovich
AlliedModders Donor
Join Date: Jun 2012
Location: Israel
Old 11-03-2013 , 09:08   Re: Array Get Num From Cvar?
Reply With Quote #2

Outside of an function, you cann't use any native
__________________
simanovich is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 11-03-2013 , 09:20   Re: Array Get Num From Cvar?
Reply With Quote #3

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.
__________________

Last edited by hleV; 11-03-2013 at 09:23.
hleV is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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