SA-MP Forums Archive
Help: I tried to remove "_" from name. but all chat has been removed. - 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: Help: I tried to remove "_" from name. but all chat has been removed. (/showthread.php?tid=465495)



Help: I tried to remove "_" from name. but all chat has been removed. - bathushan - 22.09.2013

pawn Код:
stock strreplace(string[], find, replace)
{
    for(new i=0; string[i]; i++)
    {
        if(string[i] == find)
        {
            string[i] = replace;
        }
    }
}

stock GetName(playerid)
{
    new
        name[24];
    GetPlayerName(playerid, name, sizeof(name));
    strreplace(name, '_', ' ');
    return name;
}
i used this code to remove "_" from name.
i complie it. and went to game. when i type anything. it's not even showing what i type
Help pls


Re: Help: I tried to remove "_" from name. but all chat has been removed. - tyler12 - 22.09.2013

Return the string in strreplace.


Re: Help: I tried to remove "_" from name. but all chat has been removed. - bathushan - 22.09.2013

pawn Код:
stock strreplace(string[], find, replace)
{
    for(new i=0; string[i]; i++)
    {
        if(string[i] == find)
        {
            string[i] = replace;
        }
    }
    return
}
you mean like this? (help me pls, i'm learning now)


Re: Help: I tried to remove "_" from name. but all chat has been removed. - tyler12 - 22.09.2013

Quote:
Originally Posted by bathushan
Посмотреть сообщение
pawn Код:
stock strreplace(string[], find, replace)
{
    for(new i=0; string[i]; i++)
    {
        if(string[i] == find)
        {
            string[i] = replace;
        }
    }
    return
}
you mean like this? (help me pls, i'm learning now)
Correct.

pawn Код:
stock strreplace(string[], find, replace)
{
    for(new i=0; string[i]; i++)
    {
        if(string[i] == find)
        {
            string[i] = replace;
        }
    }
    return string;
}



Re: Help: I tried to remove "_" from name. but all chat has been removed. - bathushan - 22.09.2013

Quote:
Originally Posted by tyler12
Посмотреть сообщение
Correct.

pawn Код:
stock strreplace(string[], find, replace)
{
    for(new i=0; string[i]; i++)
    {
        if(string[i] == find)
        {
            string[i] = replace;
        }
    }
    return string;
}
Tnx but not helped,
still i can't see what type... :S
any idea? help?


Re: Help: I tried to remove "_" from name. but all chat has been removed. - x96664 - 22.09.2013

Are you actually using this tutorial ?


AW: Help: I tried to remove "_" from name. but all chat has been removed. - Skimmer - 22.09.2013

Try this maybe? Btw aren't find and replace string format?

pawn Код:
stock strreplace(string[], find[], replace[], ignorecase = false)
{
    for(new i=0; sizeof(string); i++)
    {
        if(!strcmp(string[i], find, ignorecase))
        {
            strdel(string[i], 0, strlen(string[i]));
            strins(string[i], replace, 0, sizeof(string[i]));
        }
    }
    return string;
}



Re: Help: I tried to remove "_" from name. but all chat has been removed. - bathushan - 22.09.2013

Quote:
Originally Posted by x96664
Посмотреть сообщение
Are you actually using this tutorial ?
yes, i'm useing that Tut. you know why it's not working?


Re: Help: I tried to remove "_" from name. but all chat has been removed. - bathushan - 22.09.2013

Thankyou guys , Fixed,