Problem With Chat
#9

Nope. In pawno, a string array is not stored as a string.

The reason we MUST specify the array size to be one cell larger than the string itself, is because the last member of the array must carry the value 0 for it to be compiled as a string.

Because pawn is like this, you can actually create string arrays like this:
pawn Код:
new weird[6];
weird[0] = 68;
weird[1] = 65;
weird[2] = 73;
weird[3] = 86;
weird[4] = 68;
weird[5] = 0;
printf("%s", weird);
The output would be "DAVID"

EDIT: Try this

pawn Код:
if(text[0] == 33)
{
    new name[MAX_PLAYER_NAME];
    string[256];
    GetPlayerName(playerid, name, 24);
    new modifier[128];
    for(new i=1; i<sizeof(text); i++)
    {
        modifier[i-1] = text[i];
    }
    format(string, sizeof(string), "{AD855C}[Team Chat]%s: %s", name, modifier);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerTeam(playerid) == GetPlayerTeam(i))
            {
                SendClientMessage(i,yellow, string);
            }
        }
    }
    return 1;
}
Reply


Messages In This Thread
Problem With Chat - by V_LOPE - 15.12.2011, 05:56
Re: Problem With Chat - by Celson - 15.12.2011, 05:59
Re: Problem With Chat - by V_LOPE - 15.12.2011, 06:00
Re: Problem With Chat - by [ABK]Antonio - 15.12.2011, 06:03
Re: Problem With Chat - by V_LOPE - 15.12.2011, 06:08
Re: Problem With Chat - by Rob_Maate - 15.12.2011, 06:29
Re: Problem With Chat - by [ABK]Antonio - 15.12.2011, 06:35
Re: Problem With Chat - by suhrab_mujeeb - 15.12.2011, 06:38
Re: Problem With Chat - by Rob_Maate - 15.12.2011, 06:42
Re: Problem With Chat - by [ABK]Antonio - 15.12.2011, 06:44

Forum Jump:


Users browsing this thread: 2 Guest(s)