SA-MP Forums Archive
Simple ERROR - 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: Simple ERROR (/showthread.php?tid=528934)



Simple ERROR - Clergy - 30.07.2014

Error Type:
Код:
error 008: must be a constant expression; assumed zero
Code:
Код:
public OnPlayerText(playerid, text[])
{
    new
        result[128] = text;

    for(new i = 0, j = strlen(result); i < j; i++)
    {
        if('0' <= result[i] <= '9')
        {
            result[i] = '*';
        }
    }

    SendPlayerMessageToAll(playerid, result);
    return 0;
}

error line:
Код:
 result[128] = text;



Re: Simple ERROR - Abagail - 30.07.2014

You don't even have quotes. Use format to format your string. Example,

pawn Код:
public OnPlayerText(playerid, text[])
{
    new
        result[128];
    format(result, sizeof(result), "%s", text);

    for(new i = 0, j = strlen(result); i < j; i++)
    {
        if('0' <= result[i] <= '9')
        {
            result[i] = '*';
        }
    }

    SendPlayerMessageToAll(playerid, result);
    return 0;
}



Re: Simple ERROR - Clergy - 30.07.2014

Okay thanks man i didnt know its that simple im kinda stupid.

+REP