18.03.2014, 02:15
if player chat anda result is name player without underscore
pleasee anyone heve a script it
pleasee anyone heve a script it
new GlobalChat[MAX_PLAYERS];
new GlobalChatTimer[MAX_PLAYERS];
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;
}
if((nogc) && PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "The global chat channel has been disabled by an Admin!");
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(PlayerInfo[playerid][pAdmin] < 1 && PlayerInfo[playerid][pDonator] == 1)
{
format(string, sizeof(string), "(( Bronze Donator %s: %s ))", GetPlayerNameEx(playerid), params);
GlobalChatTimer[playerid] = 40;
}
else if(PlayerInfo[playerid][pAdmin] < 1 && PlayerInfo[playerid][pDonator] == 2)
{
format(string, sizeof(string), "(( Silver Donator %s: %s ))", GetPlayerNameEx(playerid), params);
GlobalChatTimer[playerid] = 30;
}
else if(PlayerInfo[playerid][pAdmin] < 1 && PlayerInfo[playerid][pDonator] == 3)
{
format(string, sizeof(string), "(( Gold Donator %s: %s ))", GetPlayerNameEx(playerid), params);
GlobalChatTimer[playerid] = 10;
}
else if(PlayerInfo[playerid][pHelper] == 1)
{
format(string, sizeof(string), "(( Junior Helper %s: %s ))", GetPlayerNameEx(playerid), params);
GlobalChatTimer[playerid] = 50;
}
else if(PlayerInfo[playerid][pHelper] == 2)
{
format(string, sizeof(string), "(( Senior Helper %s: %s ))", GetPlayerNameEx(playerid), params);
GlobalChatTimer[playerid] = 50;
}
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] = 60;
}
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] = 60;
}
else if(PlayerInfo[playerid][pAdmin] >= 1)
{
format(string, sizeof(string), "(( Level %d Admin %s: %s ))", PlayerInfo[playerid][pAdmin], GetPlayerNameEx(playerid), params);
GlobalChatTimer[playerid] = 5;
}
foreach(Player, i)
{
if(GlobalChat[i] == 1)
{
SendClientMessage(i, COLOR_NEWS, string);
}
}
return 1;
}
GlobalChat[playerid] = 0;
GlobalChatTimer[playerid] = 0;
if(GlobalChatTimer[i] > 0)
{
GlobalChatTimer[i]--;
}