Exploding string
#2

I dont't know exactly what u want, but do it like this:

PHP код:
SendExplodedMessage(playerid,-1,"Hi|This|is|a|Test");
/*
Send the player:
Hi
This
is
a
Test
*/
stock SendExplodedMessage(playerid,color,const string[])
{
    new 
tmp[128],p=strfind(string,"|"),old=-1;
    if(
p==-1) return SendClientMessage(playerid,color,string);
    for(new 
i=p; ; i=strfind(string,"|",false,i+1)) {
        
strmid(tmp,string,old+1,(i==-1)?strlen(string):i,sizeof(tmp)),old=i;
        
SendClientMessage(playerid,color,tmp);
        switch(
i) {
            case -
1: break;
        }
    }
    return 
1;

Reply


Messages In This Thread
Exploding string - by Chriham3 - 02.10.2015, 16:59
AW: Exploding string - by Kaliber - 02.10.2015, 17:07
Re: Exploding string - by Lordzy - 02.10.2015, 17:26
Re: Exploding string - by Vince - 02.10.2015, 17:41

Forum Jump:


Users browsing this thread: 1 Guest(s)