pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#define SCM SendClientMessage
forward MensagemParaChat(color,const string[]);
new Chat[MAX_PLAYERS];
public MensagemParaChat(color,const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(Chat[i] == 1)
{
SCM(i, color, string);
}
if(Chat[i] == 2)
{
SCM(i, color, string);
}
if(Chat[i] == 3)
{
SCM(i, color, string);
}
if(Chat[i] == 4)
{
SCM(i, color, string);
}
if(Chat[i] == 5)
{
SCM(i, color, string);
}//adicione mais caso quiser
}
return 1;
}
public OnPlayerText(playerid, text[])
{
if(Chat[playerid] != 0)
{
new string[ 200 ], nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, nome, sizeof(nome));
format(string, sizeof(string), "{FFFF00}[CHAT 1] {FF00FF}(%d)%s diz: {FFFFFF}%s", playerid, nome, text);
MensagemParaChat(-1, string);
return 1;
}
return 1;
}
CMD:setchat(playerid, params[])
{
new id, chat, string[ 200 ];
if(sscanf(params, "ud", id, chat)) return SCM(playerid, -1, "USE: {00FFFF}/setchat {00E5FF}[ID] [Chat]");
if(!IsPlayerAdmin(playerid)) return return SCM(playerid, -1, "Vocк nгo й administrador!");
Chat[id] = chat;
new nome[MAX_PLAYER_NAME];
GetPlayerName(id, nome, sizeof(nome));
format(string, sizeof(string), "Vocк setou o chat do id {FF00FF}(%d)%s {FFFFFF}para {FFFF00}%d!", id, nome, chat);
SCM(playerid, -1, string);
new nome2[MAX_PLAYER_NAME];
GetPlayerName(playerid, nome2, sizeof(nome2));
format(string, sizeof(string), "Administrador {FF00FF}(%d)%s {FFFFFF}setou seu chat para {FFFF00}%d!", playerid, nome2, chat);
SCM(id, -1, string);
return 1;
}
CMD:meuchat(playerid, params[])
{
new chat, string[ 200 ];
if(sscanf(params, "d", chat)) return SCM(playerid, -1, "USE: {00FFFF}/meuchat {00E5FF}[Chat]");
Chat[playerid] = chat;
new nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, nome, sizeof(nome));
format(string, sizeof(string), "Vocк setou seu chat para {FFFF00}%d!", chat);
SCM(playerid, -1, string);
return 1;
}