26.11.2014, 16:01
pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#include <foreach>
#define COLOR_GREEN 0xFFFFFFF
enum something
{
pAdmin,
VIP
};
new P_Data[MAX_PLAYERS][something];
public OnPlayerText(playerid, text[])
{
new i_chat_tex[144];
if(text[0] == '#' && P_Data[playerid][pAdmin] >= 1)
{
format(i_chat_tex,sizeof(i_chat_tex),"Admin Chat: %s: %s", Name(playerid), text[1]); // First va chat admin
MessageToAdmins(COLOR_GREEN, i_chat_tex);
return false;
}
if(text[0] == '*' && P_Data[playerid][VIP] >= 1)
{
format(i_chat_tex, sizeof(i_chat_tex), "VIP Chat: %s: %s", Name(playerid), text[1]); // After you are vip chat
MessageToPlayerVIP(0xDC686BAA, i_chat_tex);
return false;
}
if(IsPlayerConnected(playerid))
{
format(i_chat_tex, sizeof(i_chat_tex), "%s: %s", Name(playerid), text); // Finally the chat by default
SendClientMessageToAll(-1, i_chat_tex);
return false;
}
return true;
}
stock MessageToPlayerVIP(color, const string[])
{
foreach(Player, i)
{
if(IsPlayerConnected(i))
{
if(P_Data[i][VIP] >= 1)
{
SendClientMessage(i, color, string);
}
}
}
return true;
}
stock MessageToAdmins(color, const string[])
{
foreach(Player, i)
{
if(IsPlayerConnected(i))
{
if(P_Data[i][pAdmin] >= 1)
{
SendClientMessage(i, color, string);
}
}
}
return true;
}
stock Name(playerid)
{
new i_name[MAX_PLAYER_NAME];
GetPlayerName(playerid, i_name, MAX_PLAYER_NAME);
return i_name;
}