Local Chat problem - + REP!
#1

PHP код:
error 080unknown symbol, or not a constant symbol (symbol "i"
PHP код:
stock strreplace(string[], findreplace)
{
    for(new 
i=0sizeof(string[i]); i++)
    {
        if(
string[i] == find)
        {
            
string[i] = replace;
        }
    } 
what is the problem?
Reply
#2

I don't know about others, but you are missing a bracket ' } ' on the last line.
Reply
#3

pawn Код:
stock strreplace(string[], find, replace)
{

    for(new i=0; i < sizeof(string); i++)
    {
        if(string[i] == find)
        {
            string[i] = replace;
        }
    }
}
Try this
Reply
#4

Thanks no errors on the stock now but.

PHP код:
public OnPlayerText(playeridtext[])
{
    new 
pname[MAX_PLAYER_NAME], str[128];//reduce it if you want
    
GetPlayerName(playeridpnamesizeof(pname));
    
strreplace(pname'_'' ');
    
format(strsizeof(str), "%s says: %s"pnametext);//Appearance of the text submitted by a nearby player.
    /*
     * The first parameter states the radius of the area where the text will be submitted and if a player is inside the radius, the person will receive it.
     * The second parameter is the player that is submitting the text.
     * The third parameter will specify what exactly the text is, in this case %speaker says: %text.
     * The rest of the parameters are the fading colors, where how far the receiver is far from the talker.
    */
    
ProxDetector(30.0playeridstrCOLOR_FADE1COLOR_FADE2COLOR_FADE3COLOR_FADE4COLOR_FADE5);
    return 
0;//So that the text is not submitted regularly.

What is wrong here? Please help now i getting the error here.

unknown symbol, or not a constant symbol (symbol "i")
Reply
#5

Quote:
Originally Posted by Lynet
Посмотреть сообщение
Thanks no errors on the stock now but.

PHP код:
public OnPlayerText(playeridtext[])
{
    new 
pname[MAX_PLAYER_NAME], str[128];//reduce it if you want
    
GetPlayerName(playeridpnamesizeof(pname));
    
strreplace(pname'_'' ');
    
format(strsizeof(str), "%s says: %s"pnametext);//Appearance of the text submitted by a nearby player.
    /*
     * The first parameter states the radius of the area where the text will be submitted and if a player is inside the radius, the person will receive it.
     * The second parameter is the player that is submitting the text.
     * The third parameter will specify what exactly the text is, in this case %speaker says: %text.
     * The rest of the parameters are the fading colors, where how far the receiver is far from the talker.
    */
    
ProxDetector(30.0playeridstrCOLOR_FADE1COLOR_FADE2COLOR_FADE3COLOR_FADE4COLOR_FADE5);
    return 
0;//So that the text is not submitted regularly.

What is wrong here? Please help now i getting the error here.

unknown symbol, or not a constant symbol (symbol "i")
others are ok but try this
pawn Код:
stock strreplace(string[], find[], replace)
{

    for(new i=0; i < sizeof(sizeof(string)); i++)
    {
        if(string[i] == find)
        {
            string[i] = replace;
        }
    }
}
Reply
#6

getting more errors now, please post a code i can use, + rep :/
Reply
#7

Код:
stock strreplace(string[], find, replace) 
{ 

    for(new i=0; i < sizeof(string); i++) 
    { 
        if(string[i] == find) 
        { 
            string[i] = replace; 
        } 
    }
Reply
#8

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


Forum Jump:


Users browsing this thread: 1 Guest(s)