Hi guys, I already have a mute command but not with "Time", who can help me guys....
Код:
if(strcmp(cmd, "/mute", true) == 0) // Mutes the player from talking in the chat box
{
new reason[128];
new name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof name);
if (AccountInfo[playerid][AdminLevel] >= 2 || IsPlayerAdmin(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, ORANGE, "USAGE: /mute [name/id] [reason]");
return true;
}
new giveplayerid = ReturnUser(tmp);
new giveplayername[MAX_PLAYER_NAME];
new playername[MAX_PLAYER_NAME];
if(giveplayerid != INVALID_PLAYER_ID)
{
if (AccountInfo[giveplayerid][Mute] == 0)
{
GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
GetPlayerName(playerid, playername, sizeof(playername));
reason = bigstrtok(cmdtext, idx);
if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /mute [name/id] [reason]");
format(string2, sizeof(string2), "ADMIN: Admin %s has set %s on the Muteliste. [reason: %s ]", playername,giveplayername,reason);
SendClientMessageToAll(ABLAU,string2);
AccountInfo[giveplayerid][Mute] = 1;
SetTimerEx("UnMute",120000,0,"d",giveplayerid);
}
else if (AccountInfo[giveplayerid][Mute] == 1) SendClientMessage(playerid, ROT, "Error: Player is already muted.");
}
else if(giveplayerid == INVALID_PLAYER_ID)
{
//
}
}
else SendClientMessage(playerid, ROT, "Error: You aren't authorized to use this command!");
return true;
}
if(strcmp(cmd, "/unmute", true) == 0) // Unmutes a muted player
{
if (AccountInfo[playerid][AdminLevel] >= 2 || IsPlayerAdmin(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, ORANGE, "USAGE: /unmute [name/id]");
return true;
}
new giveplayerid = ReturnUser(tmp);
new giveplayername[MAX_PLAYER_NAME];
new playername[MAX_PLAYER_NAME];
if(giveplayerid != INVALID_PLAYER_ID)
{
if (AccountInfo[giveplayerid][Mute] == 1)
{
GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
GetPlayerName(playerid, playername, sizeof(playername));
format(string2, sizeof(string2), "ADMIN: Admin %s has removed %s from the Mutelist", playername,giveplayername);
SendClientMessageToAll(ABLAU, string2);
AccountInfo[giveplayerid][Mute] = 0;
}
else if (AccountInfo[giveplayerid][Mute] == 0) SendClientMessage(playerid, ROT, "Error: player isn't muted.");
}
else if(giveplayerid == INVALID_PLAYER_ID)
{
//
}
}
else SendClientMessage(playerid, ROT, "Error: You aren't authorized to use this command!");
return true;
}