public OnPlayerText(playerid, text[])
{
return 1;
}
|
public OnPlayerText(playerid,text[]) { if(text[0] == '@') { new string[128]; GetPlayerName(playerid,string,sizeof(string)); format(string,sizeof(string),"Main Chat: %s: %s",string,text[1]); SendClientMessageToAll(-1,string);}else{ new Float: x ,Float:y,Float:z; GetPlayerPos(playerid,x,y,z); for(new i=0;i<MAX_PLAYERS;i++) { if(IsPlayerConnected(i)) { if(IsPlayerInRangeOfPoint(i,10.0,x,y,z)) { new string[128]; GetPlayerName(playerid,string,sizeof(string)); format(string,sizeof(string),"Local Chat: %s: %s",string,text[1]); SendClientMessage(i,-1,string); } } } } } |
CMD:toggc(playerid, params[])
{
if(GlobalChat[playerid] == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "You have enabled global chat, use /g to chat.");
GlobalChat[playerid] = 1;
}
else if(GlobalChat[playerid] == 1)
{
SendClientMessage(playerid, COLOR_WHITE, "You have disabled global chat.");
GlobalChat[playerid] = 0;
}
return 1;
}
CMD:g(playerid, params[])
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "You're not logged in.");
return 1;
}
if(PlayerInfo[playerid][pGCMuted] > 0)
{
SendClientMessage(playerid, COLOR_GREY, "You're muted from this channel.");
return 1;
}
new string[128];
if(GlobalChatTimer[playerid] > 0)
{
format(string, sizeof(string), "You must wait %d seconds before speaking again in this channel.", GlobalChatTimer[playerid]);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
if(GlobalChat[playerid] == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "You're not in the global chat, type /toggc.");
return 1;
}
if(isnull(params))
return SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/g) [text]");
if(strlen(params) > 80)
return SendClientMessage(playerid, COLOR_GREY, "Your message is too long - the limit is 80 characters.");
if(AntiAdv(playerid, params)) return 1;
if(PlayerInfo[playerid][pAdmin] < 1 && PlayerInfo[playerid][pDonator] == 1)
{
format(string, sizeof(string), "(( Pearl VIP %s: %s ))", GetPlayerNameEx(playerid), params);
GlobalChatTimer[playerid] = 5;
}
else if(PlayerInfo[playerid][pAdmin] < 1 && PlayerInfo[playerid][pDonator] == 2)
{
format(string, sizeof(string), "(( Emerald VIP %s: %s ))", GetPlayerNameEx(playerid), params);
GlobalChatTimer[playerid] = 5;
}
else if(PlayerInfo[playerid][pAdmin] < 1 && PlayerInfo[playerid][pDonator] == 3)
{
format(string, sizeof(string), "(( Diamond VIP %s: %s ))", GetPlayerNameEx(playerid), params);
GlobalChatTimer[playerid] = 5;
}
else if(PlayerInfo[playerid][pHelper] == 1)
{
format(string, sizeof(string), "(( Junior Helper %s: %s ))", GetPlayerNameEx(playerid), params);
GlobalChatTimer[playerid] = 2;
}
else if(PlayerInfo[playerid][pHelper] == 2)
{
format(string, sizeof(string), "(( General Helper %s: %s ))", GetPlayerNameEx(playerid), params);
GlobalChatTimer[playerid] = 2;
}
else if(PlayerInfo[playerid][pHelper] == 3)
{
format(string, sizeof(string), "(( Senior Helper %s: %s ))", GetPlayerNameEx(playerid), params);
GlobalChatTimer[playerid] = 2;
}
else if(PlayerInfo[playerid][pHelper] == 4)
{
format(string, sizeof(string), "(( Head Helper %s: %s ))", GetPlayerNameEx(playerid), params);
GlobalChatTimer[playerid] = 2;
}
else if(PlayerInfo[playerid][pAdmin] < 1 && PlayerInfo[playerid][pDonator] == 1)
{
format(string, sizeof(string), "(( Level %d Player %s: %s ))", PlayerInfo[playerid][pLevel], GetPlayerNameEx(playerid), params);
GlobalChatTimer[playerid] = 5;
}
else if(PlayerInfo[playerid][pAdmin] < 1 && PlayerInfo[playerid][pDonator] == 0)
{
format(string, sizeof(string), "(( Level %d Player %s: %s ))", PlayerInfo[playerid][pLevel], GetPlayerNameEx(playerid), params);
GlobalChatTimer[playerid] = 5;
}
else if(PlayerInfo[playerid][pAdmin] == 1)
{
format(string, sizeof(string), "(( Trial Moderator %s: %s ))", GetPlayerNameEx(playerid), params);
}
else if(PlayerInfo[playerid][pAdmin] == 2)
{
if(AdminDuty[playerid] == 1)
format(string, sizeof(string), "(( Junior Admin %s: %s ))", GetPlayerNameEx(playerid), params);
else
format(string, sizeof(string), "(( Level %d Player %s: %s ))", PlayerInfo[playerid][pLevel], GetPlayerNameEx(playerid), params);
}
else if(PlayerInfo[playerid][pAdmin] == 3)
{
if(AdminDuty[playerid] == 1)
format(string, sizeof(string), "(( General Admin %s: %s ))", GetPlayerNameEx(playerid), params);
else
format(string, sizeof(string), "(( Level %d Player %s: %s ))", PlayerInfo[playerid][pLevel], GetPlayerNameEx(playerid), params);
}
else if(PlayerInfo[playerid][pAdmin] == 4)
{
if(AdminDuty[playerid] == 1)
format(string, sizeof(string), "(( Senior Admin %s: %s ))", GetPlayerNameEx(playerid), params);
else
format(string, sizeof(string), "(( Level %d Player %s: %s ))", PlayerInfo[playerid][pLevel], GetPlayerNameEx(playerid), params);
}
else if(PlayerInfo[playerid][pAdmin] == 5)
{
if(AdminDuty[playerid] == 1)
format(string, sizeof(string), "(( Head Admin %s: %s ))", GetPlayerNameEx(playerid), params);
else
format(string, sizeof(string), "(( Level %d Player %s: %s ))", PlayerInfo[playerid][pLevel], GetPlayerNameEx(playerid), params);
}
else if(PlayerInfo[playerid][pAdmin] == 6)
{
if(AdminDuty[playerid] == 1)
format(string, sizeof(string), "(( Server Management %s: %s ))", GetPlayerNameEx(playerid), params);
else
format(string, sizeof(string), "(( Level %d Player %s: %s ))", PlayerInfo[playerid][pLevel], GetPlayerNameEx(playerid), params);
}
foreach(Player, i)
{
if(GlobalChat[i] == 1)
{
SendClientMessage(i, COLOR_NEWS, string);
}
}
return 1;
}
public OnPlayerText(playerid, text[])
{
if (text[0] == '@')
{
new pname[24];
new string[128];
GetPlayerName(playerid,pname,sizeof(pname));
format(string,sizeof(string)," %s(%d): {FFFFFF}%s.",pname,playerid,text[1]);
SendClientMessageToAll(COLOR_WHITE,string);
return 0;
}
return 1;
}
but mine, if does not type @ it will send like whisper(only the players who is near him)