SA-MP Forums Archive
Local Chat problem - + REP! - 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: Local Chat problem - + REP! (/showthread.php?tid=399162)



Local Chat problem - + REP! - Lynet - 13.12.2012

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?


Re: Local Chat problem - + REP! - RajatPawar - 13.12.2012

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


Re: Local Chat problem - + REP! - Threshold - 13.12.2012

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

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


Re: Local Chat problem - + REP! - Lynet - 13.12.2012

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")


Re: Local Chat problem - + REP! - dr.lozer - 13.12.2012

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;
        }
    }
}



Re: Local Chat problem - + REP! - Lynet - 13.12.2012

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


Re: Local Chat problem - + REP! - iSkull - 17.10.2013

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

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



Re: Local Chat problem - + REP! - Konstantinos - 17.10.2013

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