Raised This Month: $ Target: $400
 0% 

cvar_to_array


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 06-07-2006 , 03:00  
Reply With Quote #2

Be more specific.

like take a cvar with a value of "12 34 56 78" and making it into an array like
array[0] = "12"
array[1] = "34"
array[2] = "56"
array[3] = "78"

If so then you can use this function for that.

Code:
stock ExplodeString( p_szOutput[][], p_iMax, p_szInput[], p_iSize, p_szDelimiter ) {     new iIdx = 0, l = strlen(p_szInput)     new iLen = (1 + copyc( p_szOutput[iIdx], p_iSize, p_szInput, p_szDelimiter ))     while( (iLen < l) && (++iIdx < p_iMax) )         iLen += (1 + copyc( p_szOutput[iIdx], p_iSize, p_szInput[iLen], p_szDelimiter ))     return iIdx }

You call it like so.
Code:
new array[6][5] , szCvar[16] get_cvar_string("mycvar" , szCvar , 15) // For reference it works like this array[p_iMax][p_iSize+1] ExplodeString(array , 6 , szCvar , 4 , ' ')
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
 



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 16:23.


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