pawn Код:
new cmd[300];
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/pchat", true) == 0)
{
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
if(IsPlayerConnected(playerid) == 1)
{
new tmps[300];
new plid;
tmps = strtok(cmdtext, idx);
if(!strlen(tmps))
{
SendClientMessage(playerid, -1, "[x]{FF0000} use: /pchat [id] [mensagem]");
return 1;
}
plid = strval(tmps);
if(IsPlayerConnected(plid))
{
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, -1, "[x]{FF0000} use: /pchat [id] [mensagem]");
}
else
{
new string[300];
new nomemanolo[MAX_PLAYER_NAME];
GetPlayerName(plid, nomemanolo, MAX_PLAYER_NAME);
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(string, sizeof(string), "(CHAT PRIVADO) |RECEBIDO| de %s disse: %s.", aname,result);
SendClientMessage(plid, -1, string);
PlayerPlaySound(plid, 1057, 0, 0, 0);
format(string, sizeof(string), "(CHAT PRIVADO) |ENVIADO| para %s disse: %s", nomemanolo,result);
SendClientMessage(playerid, -1, string);
PlayerPlaySound(playerid, 1057, 0, 0, 0);
}
}
else
{
SendClientMessage(playerid,-1,"[x] {FF0000}Este player nгo estб connectado.");
}
}
else
{
SendClientMessage(playerid,-1,"[x] {FF0000}Vocк nгo estб connectado.");;
}
return 1;
}