15.12.2011, 06:42
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:
The output would be "DAVID"
EDIT: Try this
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);
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;
}