Raised This Month: $ Target: $400
 0% 

Parse string cvar


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
G[o]Q
Member
Join Date: Jan 2010
Location: Poland (Malopolska)
Old 07-26-2010 , 16:46   Re: Parse string cvar
Reply With Quote #1

try this:
Code:
parse_item(string[],len,output[][]){
new bufor[1024];
new ile=0
for(new i=0 ;i<strlen(string);i++){
        if(!equal(string[i]," ")){
                format(bufor,1023,"%s%c",bufor,string[i]);
        }
        else
        {
                copy(output[ile],63,bufor);
                bufor = "";
                ile++
        }

}
return ile
}
Use
Code:
new string[]="asda dadawd addadaw"
new out[24][64]
new number= parse_item(string,sizeof string,output)
after use

Code:
out[0]="asda"
out[1]="dadawd"
out[2]="addadaw"
function return number of parsed items you can use this in
Code:
for(new i=0;i<number;i++) client_print(0,print_chat,"%s",out[i])

Last edited by G[o]Q; 07-26-2010 at 17:56.
G[o]Q 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 00:17.


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