03.03.2009, 08:11
pawn Код:
// Bigstrtok function.
stock bigstrtok(const string[], &idx)
{
new length = strlen(string);
while ((idx < length) && (string[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = string[idx];
idx++;
}
result[idx - offset] = EOS;
return result;
}
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new string[128],bigtext[128];
if(!strcmp(cmd,"/me",true))
{
bigtext=bigstrtok(cmdtext,idx);
if(!strlen(bigtext)) return SendClientMessage(playerid,0xAFAFAFAA,"Syntax: /me [action]");
format(string,sizeof(string)," * %s %s.",PlayerName(playerid),bigtext);
retirm SendClientMessageToAll(0xAA3333AA,string);
}
pawn Код:
PlayerName(playerid)
{
new n[24];
GetPlayerName(playerid,n,24);
return n;
}