Code:
if(strcmp(cmd, "/clearnewbie", true) == 0 || strcmp(cmd, "/clearn", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pHelper] < 1 && PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessage(playerid, TEAM_CYAN_COLOR, "You are not a helper/admin!");
return 1;
}
SendClientMessageToAll(COLOR_GRAD2, "USAGE: Newbie chat has been cleared");
format(string, sizeof(string), " ");
format(string, sizeof(string), " ");
format(string, sizeof(string), " ");
format(string, sizeof(string), " ");
format(string, sizeof(string), " ");
format(string, sizeof(string), " ");
format(string, sizeof(string), " ");
format(string, sizeof(string), " ");
format(string, sizeof(string), " ");
format(string, sizeof(string), " ");
format(string, sizeof(string), " ");
SendNewbieMessage(0x25DA53FF, string);
}
return 1;
}
if(strcmp(cmd, "/mutenew", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /mutenew(bie) [playerid/PartOfName]");
return 1;
}
new playa;
playa = ReturnUser(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 1)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
Nmute[giveplayerid] = 1;
printf("AdmCmd: %s muted %s in the newbie chat",sendername, giveplayer);
format(string, sizeof(string), "AdmCmd: %s was muted in newbie chat by %s",giveplayer ,sendername);
ABroadCast(COLOR_LIGHTRED,string,1);
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is offline.");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
}
}
return 1;
}
if(strcmp(cmd, "/unmutenew", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /unmutenew(bie) [playerid/PartOfName]");
return 1;
}
new playa;
playa = ReturnUser(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 1)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
Nmute[giveplayerid] = 0;
printf("AdmCmd: %s unmuted %s in the newbie chat",sendername, giveplayer);
format(string, sizeof(string), "AdmCmd: %s was unmuted in newbie chat by %s",giveplayer ,sendername);
ABroadCast(COLOR_LIGHTRED,string,1);
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is offline.");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
}
}
return 1;
}
if(strcmp(cmd, "/newbieoff", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pHelper] < 1 && PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessage(playerid, TEAM_CYAN_COLOR, "You are not a helper/admin!");
return 1;
}
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/newbieoff) [reason]");
return 1;
}
NewBie[playerid] = 0;
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: Newbie chat has been turned off");
}
return 1;
}
if(strcmp(cmd, "/newbieon", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pHelper] < 1 && PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessage(playerid, TEAM_CYAN_COLOR, "You are not a helper/admin!");
return 1;
}
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/newbieon) [reason]");
return 1;
}
NewBie[playerid] = 1;
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: Newbie chat has been turned on");
}
return 1;
}
if(strcmp(cmd, "/nonewbie", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] >= 1 && (!nonewbie))
{
nonewbie = 1;
BroadCast(COLOR_GRAD2, " Newbie chat channel disabled by an Admin!");
}
else if (PlayerInfo[playerid][pAdmin] >= 1 && (nonewbie))
{
nonewbie = 0;
BroadCast(COLOR_GRAD2, " Newbie chat channel enabled by an Admin!");
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You do not have admin access, denied to use the command.");
}
}
return 1;
}
if(strcmp(cmd, "/newbie", true) == 0 || strcmp(cmd, "/n", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " You havent logged in yet!");
return 1;
}
if(PlayerInfo[playerid][pLevel] < 4 || PlayerInfo[playerid][pHelper] >= 1 || PlayerInfo[playerid][pAdmin] >=1)
{ }
else
{
SendClientMessage(playerid, COLOR_GRAD2, "Nu mai esti newbie, levelul tau este deja mare. ");
return 1;
}
if ((nonewbie) && PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "The Newbie channel has been disabled by an admin!");
return 1;
}
if(PlayerInfo[playerid][pNMuted] == 1)
{
SendClientMessage(playerid, TEAM_CYAN_COLOR, " You can't speak in Newbie channel");
return 1;
}
if(newbiechannel[playerid] == 1)
{
SendClientMessage(playerid, COLOR_LIGHTGREEN," You closed the newbiechannel , use /togn.");
}
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GREEN, "USAGE: (/n)ewbie [Newbie Chat, Ask Questions]");
return 1;
}
if (PlayerInfo[playerid][pHelper] < 1)
{
format(string, sizeof(string), "* Newbie Level %d %s: %s", PlayerInfo[playerid][pLevel], sendername, result);
}
else
{
format(string, sizeof(string), "* Helper %s: %s", sendername, result);
}
if (PlayerInfo[playerid][pAdmin] >=1)
{
format(string, sizeof(string), "* Admin %s: %s", sendername, result);
}
for (new n=0; n<MAX_PLAYERS; n++)
{
if (IsPlayerConnected(n) && (PlayerInfo[n][pLevel] < 4 || PlayerInfo[n][pAdmin] > 0 || PlayerInfo[n][pHelper] > 0))
{
if(newbiechannel[n] == 0)
{
SendClientMessage(n, COLOR_LIGHTGREEN, string);
}
}
}
printf("%s", string);
}
return 1;
}
//-------------------------------------[ nmute ]---------------------------------------
if(strcmp(cmd, "/nmute", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /nmute [playerid/PartOfName]");
return 1;
}
new playa;
playa = ReturnUser(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 2)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
if(PlayerInfo[playa][pNMuted] == 0)
{
PlayerInfo[playa][pNMuted] = 1;
printf("AdmCmd: %s silenced %s in Newbie chat",sendername, giveplayer);
format(string, sizeof(string), "AdmCmd: %s was silenced in Newbie chat by %s",giveplayer ,sendername);
SendClientMessageToAll(COLOR_LIGHTRED,string);
//ABroadCast(COLOR_LIGHTRED,string,1);
}
else
{
PlayerInfo[playa][pNMuted] = 0;
printf("AdmCmd: %s unsilenced %s in Newbie chat",sendername, giveplayer);
format(string, sizeof(string), "AdmCmd: %s was unsilenced in Newbie chat by %s",giveplayer ,sendername);
SendClientMessageToAll(COLOR_LIGHTRED,string);
//ABroadCast(COLOR_LIGHTRED,string,1);
}
format(string, sizeof(string), "UPDATE profiles SET NMuted=%d WHERE Name='%s'", PlayerInfo[playa][pNMuted], giveplayer);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You do not have admin access, denied to use the command.");
}
}
return 1;
}