Mute System
#1

Hey Whats up!
well, i did my muted system but i have 1 problem, when you muted a user it works good, but if they log off with muted time when they come back to server the muted never finish.


This is my cmd

Quote:

CMD:mutear(playerid, params[])
{
if(Logged[playerid] == 1)
{
new string[128], targetid, time, reason[128];
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, blanco, "{FF0000}ERROR:{FFFFFF} Usted no esta autorizado para usar este comando");
if(sscanf(params,"rds", targetid, time, reason)) return SendClientMessage(playerid, blanco, "USA:{FFFFFF} /mutear [ID] [Segundos] [Razon]");
if(PlayerInfo[playerid][pMuted] == 1) return SendClientMessage(playerid, blanco, "{FF0000}ERROR:{FFFFFF} El jugador ya esta muteado");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, blanco, "{FF0000}ERROR:{FFFFFF} El jugador no esta conectado.");
if(PlayerInfo[targetid][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, blanco, "{FF0000}ERROR:{FFFFFF} Usted no puede mutear a ese jugador.");
format(string, sizeof(string), "%s Ha sido muteado por %s.(%d Segundos)", GetName(targetid), reason, time);
SendClientMessageToAll(COLOR_RED, string);
KillTimer(PlayerInfo[targetid][pMutedTime]);
PlayerInfo[targetid][pMuted] = 1;
PlayerInfo[targetid][pMutedTime] = SetTimerEx("unmute",time*1000, 0, "i", targetid);
}
return 1;
}

Reply
#2

PlayerInfo[playerid][pMuted] = 0;

under onplayerconnect/when they login.
Reply
#3

Quote:
Originally Posted by The__
Посмотреть сообщение
PlayerInfo[playerid][pMuted] = 0;

under onplayerconnect/when they login.
Yes, i already have this.
Reply
#4

Use unix timestamps.
Код:
PlayerInfo[targetid][pMuted] = gettime() + (minutes * 60); // minutes is actually your time from the command

OnPlayerText(playerid, text[])
{
     if(gettime() < PlayerInfo[playerid][pMuted]) 
     {
            SendClientMessage(playerid, -1, "You can't talk while you are muted."
            return 0;
     }
     return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)