auto-unmute
#1

hey how do i create an auto-unmute for this command?
Код:
CMD:mute(playerid, params[])
{
    new str[128], reason[128], id, time;
    if(PlayerAcc[playerid][Log] == 0) return SendClientMessage(playerid, COLOR_RED, "Error: You are not logged in!");
	if(PlayerAcc[playerid][Admin] >= 3)
	{
		if(sscanf(params, "uis[128]", id, time, reason)) return SendClientMessage(playerid, COLOR_RED, "Syntax: /mute (id) (minutes) (reason)");
		if(id == INVALID_PLAYER_ID) return ErrorMessages(playerid, 2);
	    if(id == playerid) return ErrorMessages(playerid, 4);
	    if(PlayerAcc[id][Mute] == 1) return SendClientMessage(playerid, COLOR_RED, "That player is already mute!");
		format(str, sizeof(str), "%s(%d) has been mute by Admin %s(%d) for %i minutes (for: %s)", GetName(id), id, GetName(playerid), playerid, time, reason);
		SendClientMessageToAll(COLOR_RED, str);
		format(str, sizeof(str), "You mute %s(%d) for %i minutes (for: %s)", GetName(id), id, time, reason);
	    SendClientMessage(playerid, COLOR_YELLOW, str);
	    PlayerAcc[id][Mute] = 1;
	    PlayerAcc[id][MuteTime] = time*time;
	    MuteTimer[id] = SetTimerEx("OnPlayerUnmute", PlayerAcc[id][MuteTime], false, "d", playerid);
	}
	else return ErrorMessages(playerid, 1);
	return 1;
}
some admins forgot to use /unmute. i need an auto unmute saying "%s(%d) have been automatically unmuted."
Reply
#2

You just create a public OnPlayerUnmute which will be called after the time an admin has set to a certain player. Do you know what I am talking about or do you need an example?
Reply
#3

So what he means is...

PHP код:
new mutetime;
mutetime gettime();
mutetime += time*time;
PlayerAcc[id][MuteTime] = mutetime;
MuteTimer[id] = SetTimerEx("OnPlayerUnmute"PlayerAcc[id][MuteTime], false"d"playerid); 
I don't get why you're doing

time*time

When time should be..
time*60

so example..
If you mute for 10 - It will then *60 = 10 minutes..
Reply
#4

Quote:
Originally Posted by Prokill911
Посмотреть сообщение
When time should be..
time*60
hehe i forgot to set it to *60.

i just need an example on how to create an auto unmute saying: "%s(%d) have been automatically unmuted.
Reply
#5

Something like this

pawn Код:
forward OnPlayerUnmute(MuteTimerID[id]);
public OnPlayerUnmute(MuteTimerID[id])
{
       new str[64];
           format(str, sizeof(str), "%s(%d) has been unmuted ", GetName(MuteTimerID[id]),MuteTimerID[id]);
        SendClientMessageToAll(COLOR_RED, str);
       PlayerAcc[MuteTimerID[id]][Mute] = 0;
        PlayerAcc[MuteTimerID[id]][MuteTime] = 0;
    return 1;
}
Reply
#6

Quote:
Originally Posted by Sime30
Посмотреть сообщение
Something like this

pawn Код:
forward OnPlayerUnmute(MuteTimerID[id]);
public OnPlayerUnmute(MuteTimerID[id])
{
       new str[64];
           format(str, sizeof(str), "%s(%d) has been unmuted ", GetName(MuteTimerID[id]),MuteTimerID[id]);
        SendClientMessageToAll(COLOR_RED, str);
       PlayerAcc[MuteTimerID[id]][Mute] = 0;
        PlayerAcc[MuteTimerID[id]][MuteTime] = 0;
    return 1;
}
it's saying: undefined symbol "id" for the two of these:
Код:
forward OnPlayerUnmute(MuteTimerID[id]);
public OnPlayerUnmute(MuteTimerID[id])
Reply
#7

anyone?damn it.
Reply
#8

Hello!

PHP код:
forward OnPlayerUnmute(MuteTimerID[id]);
public 
OnPlayerUnmute(MuteTimerID[id])
{
       new 
str[64];
           
format(strsizeof(str), "%s(%d) has been unmuted "GetName(MuteTimerID[id]),MuteTimerID[id]);
        
SendClientMessageToAll(COLOR_REDstr);
       
PlayerAcc[MuteTimerID[id]][Mute] = 0;
        
PlayerAcc[MuteTimerID[id]][MuteTime] = 0;
      return 
1;

to
PHP код:
forward OnPlayerUnmute(playerid);
public 
OnPlayerUnmute(playerid)
{
    new 
str[64];
    
format(strsizeof(str), "%s(%d) has been unmuted "GetName(playerid),playerid);
    
SendClientMessageToAll(COLOR_REDstr);
    
PlayerAcc[playerid][Mute] = 0;
    
PlayerAcc[playerid][MuteTime] = 0;
    return 
1;

- Mencent
Reply
#9

test it. I got mute for one min, didn't unmute. it only auto unmute me when I got killed or /kill.
Reply
#10

pawn Код:
new MuteTimer[MAX_PLAYERS];
CMD:mute(playerid, params[])
{
    if(PlayerAcc[playerid][Log] == 0) return SendClientMessage(playerid, COLOR_RED, "Error: You are not logged in!");
    if(PlayerAcc[playerid][Admin] < 3) return ErrorMessages(playerid, 1);

    new reason[128], id, time;
    if(sscanf(params, "uis[128]", id, time, reason)) return SendClientMessage(playerid, COLOR_RED, "Syntax: /mute (id) (minutes) (reason)");

    if(id == INVALID_PLAYER_ID) return ErrorMessages(playerid, 2);
    if(id == playerid) return ErrorMessages(playerid, 4);
    if(PlayerAcc[id][Mute] == 1) return SendClientMessage(playerid, COLOR_RED, "That player is already mute!");

    new str[128];
    format(str, sizeof(str), "%s(%d) has been mute by Admin %s(%d) for %i minutes (for: %s)", GetName(id), id, GetName(playerid), playerid, time, reason);
    SendClientMessageToAll(COLOR_RED, str);
    format(str, sizeof(str), "You mute %s(%d) for %i minutes (for: %s)", GetName(id), id, time, reason);
    SendClientMessage(playerid, COLOR_YELLOW, str);
   
    PlayerAcc[id][Mute] = 1;
    PlayerAcc[id][MuteTime] = time;
   
    MuteTimer[id] = SetTimerEx("OnPlayerUnmute", 1000*60*time, false, "d", id);
    return 1;
}

forward OnPlayerUnmute(id);
public OnPlayerUnmute(id)
{
    new str[64];
    format(str, sizeof(str), "%s(%d) has been unmuted ", GetName(id), id);
    SendClientMessageToAll(COLOR_RED, str);
    PlayerAcc[id][Mute] = 0;
    PlayerAcc[id][MuteTime] = 0;
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)