13.03.2014, 23:04
I've got this admin system recently, but I'm facing issues with the /mute command, it works actually, but I can still chat..
Here's the mute command:
This is the OnPlayerText callback, all of it:
Hmm? I need suggestions as soon as possible please.
Here's the mute command:
pawn Код:
COMMAND:mute(playerid,params[])
{
if(PlayerInfo[playerid][AdminLevel] >= LEVEL_mute)
{
new player, time, reason[128];
if(sscanf(params, "rds[128]", player, time, reason))
{
SendClientMessage(playerid,RED,"Usage: /mute <playerid/part of nick> <seconds> <reason>");
return 1;
}
if(PlayerInfo[player][Muted] == true)
{
SendClientMessage(playerid,RED,"This player is already muted");
return 1;
}
if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID)
{
PlayerInfo[player][Muted] = true;
format(string,sizeof(string),"**%s has been muted by Admin '%s' for %d seconds [Reason: %s]",GetName(player), GetName(playerid), time, reason);
SendClientMessageToAll(YELLOW,string);
PlayerInfo[player][MuteTimer] = SetTimerEx("unmute",time*1000, false, "d", player);
}
else
{
SendClientMessage(playerid, RED, "Player is not connected!");
}
}
else
{
SendClientMessage(playerid, RED, NO_PERM);
}
return 1;
}
pawn Код:
public OnPlayerText(playerid, text[])
{
if(text[0] == '!')
{
GetPlayerName(playerid, string, sizeof(string));
format(string, sizeof(string), "[TEAM] {0000FF}%s {FFFF00}({FF0000}%d{FFFF00}): {88AA88}%s", string, playerid, text[1]);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && gTeam[i] == gTeam[playerid]) SendClientMessage(i, TEAM_MSG, string);
}
if(PlayerInfo[playerid][Logged] != true)
{
SendClientMessage(playerid, GREY, "You need to login to use the chat");
return 0;
}
if(ServerInfo[EnableChat] == false)
{
SendClientMessage(playerid, GREY, "The chat has been disabled");
return 0;
}
#if USE_VIP_SYSTEM == true
if(text[0] == '!' && PlayerInfo[playerid][VIPLevel] >= 1)
{
GetPlayerName(playerid,string,sizeof(string));
format(string,sizeof(string),"VIP Chat %s: %s",string,text[1]);
VIPMSG(ORANGE,string);
return 0;
}
#endif
#if ENABLE_ADMIN_CHAT == true
if(text[0] == '#' && PlayerInfo[playerid][AdminLevel] >= 1)
{
GetPlayerName(playerid,string,sizeof(string));
format(string,sizeof(string),"Admin Chat %s: %s",string,text[1]);
AdminMSG(GREEN,string);
return 0;
}
#endif
#if USE_ANTI_ADS == true
new
is1 = 0,
r = 0,
strR[255];
while(strlen(text[is1]))
{
if('0' <= text[is1] <= '9')
{
new is2 = is1 + 1, p=0;
while(p == 0)
{
if('0' <= text[is2] <= '9' && strlen(text[is2]))
{
is2++;
}
else
{
strmid(strR[r], text, is1, is2, sizeof(strR));
if(strval(strR[r]) < sizeof(strR)) r++;
is1 = is2;
p = 1;
}
}
}
is1++;
}
if(r >= 4)
{
SendClientMessage(playerid, RED, "Advertising is not allowed");
return 0;
}
#endif
else if(ServerInfo[NoCaps] == true)
{
UpperToLower(text);
}
else if(PlayerInfo[playerid][Muted] == true)
{
SendClientMessage(playerid, RED,"You have been muted! Please wait until the time is over!");
return 1;
}
else
{
#if USE_CHAT_BUBBELS == true
new cbMSG[150];
format(cbMSG,sizeof(cbMSG),"%s", text);
SetPlayerChatBubble(playerid, cbMSG, WHITE, 65.0, 8000);
#endif
#if USE_ID_MESSAGES == true
new idMSG[150];
format(idMSG,sizeof(idMSG),"%s (%d): {FFFFFF}%s", GetName(playerid), playerid, text);
SendClientMessageToAll(GetPlayerColor(playerid), idMSG);
#endif
}
return 0;
}
return 1;
}