01.09.2013, 17:53
Hi guys i create my mute command after i read some about timers and how they work
My codes
In the top of script after colors etc
My commands
I just need help now please in OnPlayertext to define that if he muted it return and Sendclientmessage to him saying that You are muted from chating you can't talk
-Thanks.
My codes
In the top of script after colors etc
pawn Код:
new Mutetimer[MAX_PLAYERS];
new Muted[MAX_PLAYERS];
pawn Код:
CMD:mute(playerid,params[])
{
if(PlayerInfo[playerid][pAdminLevel] == 0) return SendClientMessage(playerid,-1,"{FF0000}[ERROR]:{FAF5F5}You are not{FF0000} Administrator {FAF5F5}to use this command");
new id,time,reason[100],PlayerName[MAX_PLAYER_NAME],GPlayerName[MAX_PLAYER_NAME],String[126];
if(sscanf(params,"dds[30]",id,time,reason)) return SendClientMessage(playerid, -1, "{FF0000}[System Usage]:{FAF5F5}/mute [playerid] [time] [reason]");
if (!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "{FF0000}[ERROR]:{FAF5F5}Player is not connected!");
if(Muted[id] == 1) return SendClientMessage(playerid, -1, "{FF0000}[ERROR]:{FAF5F5}This player already muted!");
GetPlayerName(id, PlayerName, sizeof(PlayerName));
GetPlayerName(playerid, GPlayerName, sizeof(GPlayerName));
format(String, sizeof(String), "{FF0000}Adminstrator{FAF5F5}%s has mute %s for %d mins | Reason:{FF0000} %s", GetPlayerNameEx(playerid),GetPlayerNameEx(id), time, reason);
SendClientMessageToAll(-1, String);
Mutetimer[id] = SetTimerEx("Unmute",time*6000, false, "i", id);
return 1;
}
CMD:unmute(playerid,params[])
{
new id;
if(PlayerInfo[playerid][pAdminLevel] == 0) return SendClientMessage(playerid,-1,"{FF0000}[ERROR]:{FAF5F5}You are not{FF0000} Administrator {FAF5F5}to use this command");
if(sscanf(params,"u",id)) return SendClientMessage(playerid, -1, "{FF0000}[System Usage]:{FAF5F5}/unmute [playerid]");
KillTimer(Mutetimer[id]);
return 1;
}
-Thanks.