14.12.2012, 15:16
pawn Код:
new pMutedTimer[MAX_PLAYERS];
CMD:mute(playerid, params[])
{
new id, string[128], time;
if(PlayerInfo[playerid][pAdmin] < 1)return NisiAdmin(playerid);
else if(sscanf(params, "ui", id, time))return Koristi(playerid, "/mute [ime/ID] [Time in seconds]");
if(time < 0) return SendClientMessage(playerid, -1, "Time cannot be lower than 0");
else if(id == INVALID_PLAYER_ID) return PogresanID(playerid);
SetPVarInt(id, "Mutan", 1);
format(string, sizeof(string), ""#COL_YELLOW"Mute|Utisao si igraca %s!",PlayerName(id));
SendClientMessage(playerid,-1, string);
format(string, sizeof(string), ""#COL_YELLOW"Mute|Mutan si od Admina %s!",PlayerName(playerid));
SendClientMessage(id,-1, string);
pMutedTimer[id] = SetTimerEx("unmute", time, 0, "ii", id, 0);
return 1;
}
forward unmutef(p, f);
public unmutef(p, f)
{
KillTimer(pMutedTimer(p));
SetPVarInt(p, "Mutan", 0);
if(!f)
{
SendClientMessage(p, -1, "You have been automatically unmuted.");
}
return 1;
}
CMD:unmute(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 1) return NisiAdmin(playerid);
extract params -> new player:a; else return SendClientMessage(playerid, -1, "/unmute [ime/ID]")
if(!GetPVarInt(a, "Mutan")) return SendClientMessage(playerid, -1, "That player is not muted.");
unmutef(a, 1);
new string[128], name[MAX_PLAYER_NAME];
GetPlayerName(a, name, MAX_PLAYER_NAME);
format(string, 128, "You have unmuted %s(%i).", name, a);
SendClientMessage(playerid, -1, string);
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(string, 128, "Administrator %s(%i) has unmuted you.", name, playerid);
SendClientMessage(a, -1, string);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(GetPVarInt(playerid, "Mutan"))
{
unmutef(playerid, 1);
}
//code
return 1;
}
lol late, again.