Quit This in the script -
NitroZeth - 07.09.2017
Hi, I would like to remove the maxadmin level function in my irc mute and unmute commands
this :
Код:
if((AccInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) ) {
i want remove it from cmd who can help?
Код:
IRCCMD:mute(botid, channel[], user[], host[], params[]) {
// Check if the user is at least a halfop in the channel
if (IRC_IsHalfop(botid, channel, user))
{
new playerid, reason[64];
// If the user did enter a player ID, then the command will not be processed
if (sscanf(params, "dz", playerid, reason))
{
return 1;
}
// If the player is not connected, then nothing will be done
if (IsPlayerConnected(playerid) && playerid != INVALID_PLAYER_ID)
{
new string[128], playername[MAX_PLAYER_NAME];
// If no reason is given, then "No reason" will be stated
if (isnull(reason))
{
format(reason, sizeof(reason), "No reason");
}
if((AccInfo[playerid][Level] != Info[MaxAdminLevel]) ) {
if(AccInfo[playerid][Muted] == 0) {
GetPlayerName(playerid, playername, sizeof(playername));
PlayerPlaySound(playerid,1057,0.0,0.0,0.0); AccInfo[playerid][Muted] = 1; AccInfo[playerid][MuteWarnings] = 0;
format(string,sizeof(string),"You have been muted by IRC Administrator %s [reason: %s]",user,reason); Inter_SendClientMessage(playerid,blue,string);
format(string,sizeof(string),"2You have muted %s [reason: %s]", playername,reason); return IRC_GroupSay(groupID, IRC_CHANNEL, string);
} else return IRC_GroupSay(groupID, IRC_CHANNEL, "4Player is already muted");
} else return IRC_GroupSay(groupID, IRC_CHANNEL, "4ERROR: Player is the highest level admin");
} else return IRC_GroupSay(groupID, IRC_CHANNEL, "4ERROR: Player is not connected");
} else return IRC_GroupSay(groupID, IRC_CHANNEL, "4ERROR: You must be channel half operator to use this commands");
}
IRCCMD:unmute(botid, channel[], user[], host[], params[]) {
// Check if the user is at least a halfop in the channel
if (IRC_IsHalfop(botid, channel, user))
{
new playerid, playername[MAX_PLAYER_NAME],string[128];
// If the user did enter a player ID, then the command will not be processed
if (sscanf(params, "d", playerid))
{
return 1;
}
// If the player is not connected, then nothing will be done
if (IsPlayerConnected(playerid) && playerid != INVALID_PLAYER_ID)
{
if(AccInfo[playerid][Level] != Info[MaxAdminLevel]) {
if(AccInfo[playerid][Muted] == 1) {
PlayerName2(playerid, playername, sizeof(playername));
PlayerPlaySound(playerid,1057,0.0,0.0,0.0); AccInfo[playerid][Muted] = 0; AccInfo[playerid][MuteWarnings] = 0;
format(string,sizeof(string),"You have been unmuted by IRC Administrator %s",user); Inter_SendClientMessage(playerid,blue,string);
format(string,sizeof(string),"2You have unmuted %s", playername); return IRC_GroupSay(groupID, IRC_CHANNEL, string);
} else return IRC_GroupSay(groupID, IRC_CHANNEL, "2Player is not muted");
} else return IRC_GroupSay(groupID, IRC_CHANNEL, "4ERROR: Player is the highest level admin");
} else return IRC_GroupSay(groupID, IRC_CHANNEL, "4ERROR: Player is not connected");
} else return IRC_GroupSay(groupID, IRC_CHANNEL, "4ERROR: You must be channel half operator to use this command");
}
Re: Quit This in the script -
MP2 - 08.09.2017
That code is such a mess, jesus.
Just remove that line, its associated brackets and the code inside the brackets.
Remove this line also:
pawn Код:
} else return IRC_GroupSay(groupID, IRC_CHANNEL, "4ERROR: Player is the highest level admin");
I always hate seeing that indentation style and the use of loads of else/if statements - it just makes the code harder to read. This is much clearer:
pawn Код:
IRCCMD:unmute(botid, channel[], user[], host[], params[])
{
// Check if the user is at least a halfop in the channel
if (!IRC_IsHalfop(botid, channel, user)) return IRC_GroupSay(groupID, IRC_CHANNEL, "4ERROR: You must be channel half operator to use this command");
new playerid, playername[MAX_PLAYER_NAME],string[128];
// If the user did enter a player ID, then the command will not be processed
if (!sscanf(params, "d", playerid))
{
// If the player is not connected, then nothing will be done
if (!IsPlayerConnected(playerid) || playerid != INVALID_PLAYER_ID) return return IRC_GroupSay(groupID, IRC_CHANNEL, "4ERROR: Player is not connected");
// Check if the player is already muted
if(AccInfo[playerid][Muted] == 0) return IRC_GroupSay(groupID, IRC_CHANNEL, "2Player is not muted");
PlayerName2(playerid, playername, sizeof(playername));
PlayerPlaySound(playerid,1057,0.0,0.0,0.0); AccInfo[playerid][Muted] = 0; AccInfo[playerid][MuteWarnings] = 0;
format(string,sizeof(string),"You have been unmuted by IRC Administrator %s",user); Inter_SendClientMessage(playerid,blue,string);
format(string,sizeof(string),"2You have unmuted %s", playername); return IRC_GroupSay(groupID, IRC_CHANNEL, string);
}
}