12.10.2009, 21:02
pawn Код:
#include <a_samp>
#define TEAM_HUMAN_COLOR 0x33AA33AA
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
if(strcmp(cmd, "/r", 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,0x33AA33AA, "USAGE: /r [radio chat]");
return 1;
}
format(string, sizeof(string), "CB Radio: %s says: %s", sendername, result);
SendClientMessageToAll(0x33AA33AA,string);
printf("%s", string);
return 1;
}
}
return 0;
}