Help: I tried to remove "_" from name. but all chat has been removed.
#1

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
Reply
#2

Return the string in strreplace.
Reply
#3

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)
Reply
#4

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;
}
Reply
#5

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?
Reply
#6

Are you actually using this tutorial ?
Reply
#7

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;
}
Reply
#8

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

Thankyou guys , Fixed,
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)