SA-MP Forums Archive
proble with function I worte - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: proble with function I worte (/showthread.php?tid=324377)



proble with function I worte - amit133 - 09.03.2012

Hi,
I worte thi func:
PHP код:
stock RemoveWord(text[],word[64])
{
    new 
newtext[256];
    new 
tchar[256];
    new 
tchar2[64];
    new 
tword[64];
    new 
0;
    while(
strlen(word)){
    for(new 
0;<= strlen(text);i++)
    {
        if(!
strlen(text[i]))break;
        if(
strcmp(text[i],word[k],true))tchar[i] = text[i],strcat(newtext,tchar[i]);
        if(!
strcmp(text[i],word[k],true))
        {
          
k++;
          if(!
strcmp(tword,word,true))break;
        if(!
strcmp(text[i],word[k],true))tchar2[k] = text[i],strcat(tword,tchar2[k]);
        if(
strcmp(text[i],word[k],true) != 0)
        {
            
strcat(newtext,tword);
        }
        }
    }
    break;
    }
    
SendClientMessageToAll(red,newtext);
    return 
newtext;

and it work when its look like this:
the text: I love pizza
the word: pizza
the output: I love
But if it like this
the text: I love pizza so much
the word: pizza
the output: I love pizza so much

what the problem?


Re: proble with function I worte - amit133 - 09.03.2012

help?


Re: proble with function I worte - amit133 - 10.03.2012

please help me