pawn Код:
public OnPlayerText(playerid, text[])
{
//FunctionLog("OnPlayerText");
if(Variables[playerid][Muted]) {SendClientMessage(playerid,Colors[2],"You're muted."); return 0;}//muted by admin script
if(Variables[playerid][LoggedIn] == false && Variables[playerid][Registered] == true)
{
SendClientMessage(playerid,Colors[2],"Please login before chatting.");
return 0;
}
if(text[0] == '@' && Variables[playerid][Registered] == true && Variables[playerid][Level] > 0)//normal admin chat
{
new string[128];
format(string,sizeof(string),"Admin %s: %s",RealName[playerid],text[1]);
foreach(Player,i)
{
if(Variables[i][Registered] == true && Variables[i][Level] > 0)
{
SendClientMessage(i,Colors[4],string);
}
}
return 0;
}
else if(text[0] == '$' && Variables[playerid][Level] >= 6)//high level admin chat
{
new string[128];
format(string,sizeof(string),"[G-Admin] %s: %s",RealName[playerid],text[1]);
foreach(Player,i)
{
if(Variables[i][Level] >= 6)
{
SendClientMessage(i,Colors[1],string);
}
}
return 0;
}
if(SlideSho == true)return 0;
if(AFK[playerid] == true)
{
SendClientMessage(playerid,MainColors[2],"You must type /BACK before doing anything!");//player is afk
return 0;
}
if(NoText[playerid] == true && !IsPlayerAdmin(playerid))//spam filter for non-admins
{
new string[64];
format(string,sizeof(string),"Sorry, you can only use text once every %d second(s)",TextTime);
SendClientMessage(playerid,MainColors[2],string);
return 0;
}
else
{
NoText[playerid] = true;
SetTimerEx("AllowText",TextTime*1000,0,"i",playerid);
}
if(PlayerWorld[playerid] != -1 && Playing[playerid] == false)//player is in a special world
{
if(text[0] == ' ')
{
if(IDnames == true)
{
new string[24],name[24];
GetPlayerName(playerid,name,sizeof(name));
TempName[playerid] = name;
format(string,sizeof(string),"[%d]%s",playerid,NickName[playerid]);
SetPlayerName(playerid,string);
SetTimerEx("ResetPlayerName",1,0,"i",playerid);
SendPlayerMessage2All(playerid,text);
return 0;
}
new name[24];
GetPlayerName(playerid,name,sizeof(name));
TempName[playerid] = name;
SetPlayerName(playerid,NickName[playerid]);
SetTimerEx("ResetPlayerName",1,0,"i",playerid);
SendPlayerMessage2All(playerid,text);
return 0;
}
else
{
SendClientMessageToWorld(playerid,PlayerWorld[playerid],text);
}
return 0;
}
else if(RoundMuting == true && Current != -1 && text[0] != ' ' && gTeam[playerid] >= 0 && gTeam[playerid] < ACTIVE_TEAMS)//normal chat in rounds is muted (space = global chat)
{
Team_SendClientMessage(playerid,gTeam[playerid],text[0]);
return 0;
}
else if(text[0] == '!')//team message
{
Team_SendClientMessage(playerid,gTeam[playerid],text[1]);
return 0;
}
if(IDnames == true)
{
if(Current != -1 && Playing[playerid] == true && NoNameMode == true)
{
new string[24];
TempName[playerid] = NoNames[playerid];
format(string,sizeof(string),"[%d]%s",playerid,NickName[playerid]);
SetPlayerName(playerid,string);
SetTimerEx("ResetPlayerName",1,0,"i",playerid);
SendPlayerMessage2All(playerid,text);
return 0;
}
else
{
new string[24],name[24];
GetPlayerName(playerid,name,sizeof(name));
TempName[playerid] = name;
format(string,sizeof(string),"[%d]%s",playerid,NickName[playerid]);
SetPlayerName(playerid,string);
SetTimerEx("ResetPlayerName",1,0,"i",playerid);
SendPlayerMessage2All(playerid,text);
return 0;
}
}
else
{
new name[24];
GetPlayerName(playerid,name,sizeof(name));
TempName[playerid] = name;
SetPlayerName(playerid,NickName[playerid]);
SetTimerEx("ResetPlayerName",1,0,"i",playerid);
SendPlayerMessage2All(playerid,text);
return 0;
}
//return 1;
}