02.03.2009, 19:15
pawn Код:
if(strcmp(cmd, "/cb", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new string[128], sendername[MAX_PLAYER_NAME], idx;
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /cb [radio chat]");
return 1;
}
format(string, sizeof(string), "CB Radio: %s says: %s", sendername, result);
SendClientMessageToAll(COLOR_YELLOW,string);
printf("%s", string);
return 1;
}
return 1;
}
Edit: should compile now,

