Raised This Month: $ Target: $400
 0% 

Any information to do with the array include.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dygear
SourceMod Donor
Join Date: Apr 2004
Location: Levittown, NY
Old 08-29-2005 , 10:20   Any information to do with the array include.
Reply With Quote #1

I wanted to get a good idea on how to use it. This is mainly to do with a bunch of names, or rather parts of names, that I want to check against a list. I would use fread to get it into one variable but then I must be able to separate it out so I can check each individual tag against the players name. But there seems to be no good and clean way of getting this working. Oh, and there is no real help in the funciton list, as it does not tell you how to even place it in your code.

I WANT EXPLODE FROM PHP!
__________________
Dygear is offline
Send a message via AIM to Dygear Send a message via MSN to Dygear Send a message via Skype™ to Dygear
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 08-29-2005 , 10:34  
Reply With Quote #2

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 + 1) }
xero's ( used in my Satchel Charges plugin )
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Dygear
SourceMod Donor
Join Date: Apr 2004
Location: Levittown, NY
Old 08-29-2005 , 23:23  
Reply With Quote #3

Thanks

[EDIT]
How would use use it. Say I wanted to separate, a /n (new line), or a "/". How would I do it.

[EDIT]
Eh, took alook at the plugin, would seem that if I wanted to remove the / from the string and call each of these into BCL then I would do this . . . Right?


Code:
ExplodeString(BCL,MAX_CVAR_VALS,BadClanFile,31,'/')
__________________
Dygear is offline
Send a message via AIM to Dygear Send a message via MSN to Dygear Send a message via Skype™ to Dygear
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 08-29-2005 , 23:41  
Reply With Quote #4

Seeminginly not as complicated version by Asskickr:

Code:
stock explode( output[][], input[], delimiter, textlen ) {         new nIdx = 0         new nLen = (1 + copyc( output[nIdx], textlen, input, delimiter ))         while( nLen < strlen(input) )         nLen += (1 + copyc( output[++nIdx], textlen, input[nLen], delimiter )) } new newstring[10][64]; new oldstring[64]; oldstring = "I|LOVE|SPLITTING|TEN|WORDS|INTO|LITTLE|TINY|SMALLER|PIECES"; explode(newstring, oldstring, '|', 63);

Make sure the third argument is a character, not a string (apostrophes instead of quotation marks).
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
BAILOPAN
Join Date: Jan 2004
Old 08-30-2005 , 00:44  
Reply With Quote #5

<_< what if nIdx overflows
__________________
egg
BAILOPAN is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 08-30-2005 , 01:16  
Reply With Quote #6

Then you'll get nasty runtime errors and be ashamed of yourself for not accounting for that.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
BAILOPAN
Join Date: Jan 2004
Old 08-30-2005 , 01:22  
Reply With Quote #7

or you can fix it ;]

(also I've optimized it a bit, doing a strlen() in an iterator condition is slow)

Code:
stock explode( output[][], input[], delimiter, textlen, maxMatches ) {         new nIdx = 0         new nLen = (1 + copyc( output[nIdx], textlen, input, delimiter ))         new len = strlen(input)         while( nLen < len && nIdx < maxMatches )         nLen += (1 + copyc( output[++nIdx], textlen, input[nLen], delimiter )) } new newstring[10][64]; new oldstring[64]; oldstring = "I|LOVE|SPLITTING|TEN|WORDS|INTO|LITTLE|TINY|SMALLER|PIECES"; explode(newstring, oldstring, '|', 63, 10);
__________________
egg
BAILOPAN is offline
Dygear
SourceMod Donor
Join Date: Apr 2004
Location: Levittown, NY
Old 09-01-2005 , 21:58  
Reply With Quote #8

Thank you BAILOPAN.
__________________
Dygear is offline
Send a message via AIM to Dygear Send a message via MSN to Dygear Send a message via Skype™ to Dygear
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 14:26.


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