Raised This Month: $ Target: $400
 0% 

cvar_to_array


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Chex
Junior Member
Join Date: Jun 2006
Old 06-07-2006 , 02:46   cvar_to_array
Reply With Quote #1

Is this even a function? It does not work for me. Any ideas on making it work?
Chex is offline
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
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 16:23.


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