Raised This Month: $ Target: $400
 0% 

Strings and pawn


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Zenith77
Veteran Member
Join Date: Aug 2005
Old 02-24-2007 , 19:05   Re: Strings and pawn
Reply With Quote #3

goku: No.

To split strings, like your trying to do, use this stock.

Code:
stock ExplodeString( p_szOutput[][], p_nMax, p_nSize, p_szInput[], p_szDelimiter ) { // Function by xeroblood     new nIdx = 0, l = strlen(p_szInput)     new nLen = (1 + copyc( p_szOutput[nIdx], p_nSize, p_szInput, p_szDelimiter ))     while( (nLen < l) && (++nIdx < p_nMax) )         nLen += (1 + copyc( p_szOutput[nIdx], p_nSize, p_szInput[nLen], p_szDelimiter ))     return nIdx }

You can use it like this:
Code:
new string[] = "STEAM%STEAM%STEAM"; new steamid[3][32]; // This will be all 3 steam ids split from the string. ExplodeString(steamid, 2, 31, string, '%'); // variable 'steamid' now contains all steamids in the first dimension (steamid[0], steamid[1], steamid[2]).

You can kick them, continuing on the code above, like this:
Code:
new i; for (i = 0; i < 2; i++)      server_cmd("kick ^"%s^" ^"You were kicked due to your steamid.^"", steamid[i]);

Let me know if you have any compile time errors.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred

Last edited by Zenith77; 02-25-2007 at 09:58. Reason: Fixed ExplodeString() 4th parameter.
Zenith77 is offline
 



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 00:45.


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