I want to add time in my mute command HELP :D
#1

Hi all I'm back an need help ^^
I want to make my /mute command not only /mute <ID> <Reason> but /Mute <ID> <Minutes> <Reason>

Is this hard to do? ^^ I would like to learn how to do it, btw here is the code:

Код:
CMD:mute(playerid,params[])
{
	if(AccInfo[playerid][LoggedIn] == 1)
	{
		if(AccInfo[playerid][Level] >= 2)
		{
		    new tmp[256];
			new tmp2[256];
			new Index;
			tmp = strtok(params,Index);
			tmp2 = strtok(params,Index);
		    if(isnull(params)) return
			Inter_SendClientMessage(playerid, LIGHTBLUE2, "Usage: /mute [PlayerID] [Reason]") &&
			Inter_SendClientMessage(playerid, orange, "Function: Will mute the specified player");
			new playername[MAX_PLAYER_NAME];
			new adminname [MAX_PLAYER_NAME];
	    	new player1, string[128];
			player1 = strval(tmp);
		 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && (AccInfo[player1][Level] != ServerInfo[MaxAdminLevel]) )
			 {
		 	    if(AccInfo[player1][Muted] == 0)
		 	    {
					GetPlayerName(player1, playername, sizeof(playername));
					GetPlayerName(playerid, adminname, sizeof(adminname));
					SendCommandToAdmins(playerid,"Mute");
					PlayerPlaySound(player1,1057,0.0,0.0,0.0);
					AccInfo[player1][Muted] = 1;
					AccInfo[player1][MuteWarnings] = 0;
					if(strlen(tmp2))
					{
					format(string,sizeof(string),"|- You have been Muted by Administrator %s | Reason: %s -|",adminname,params[2]);
					Inter_SendClientMessage(player1,blue,string);
					format(string,sizeof(string),"|-  You have Muted %s | Reason: %s -|", playername,params[2]);
					return Inter_SendClientMessage(playerid,BlueMsg,string);
					}
					else
					{
					format(string,sizeof(string),"|- You have been muted by Administrator %s | No Specified Reason! -|",adminname);
					Inter_SendClientMessage(player1,blue,string);
					format(string,sizeof(string),"|- You have Muted %s -|", playername);
					return Inter_SendClientMessage(playerid,BlueMsg,string);
					}
				}
				else return Inter_SendClientMessage(playerid, red, "ERROR: Player is already muted");
			}
			else return Inter_SendClientMessage(playerid, red, "ERROR: Player is not connected or is the highest level admin");
		}
		else return ErrorMessages(playerid, 1);
	}
	else return Inter_SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}
Reply
#2

To set the minute you can use timer:
pawn Код:
forward Unmute(playerid);

SetTimerEx("Unmuted",minute,0,"d",playerid1);//inside you mute command

public Unmute(playerid)
{
         AccInfo[playerid][Muted] = false;
         return 1;
}
Reply
#3

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
To set the minute you can use timer:
pawn Код:
forward Unmute(playerid);

SetTimerEx("Unmuted",minute,0,"d",playerid1);//inside you mute command

public Unmute(playerid)
{
         AccInfo[playerid][Muted] = false;
         return 1;
}
I dont understand how I should make the command.

Use the command code I gave and give me a new one that is edited so it would work with making a add minutes
if I need any other code please give me that too
Reply
#4

I hate editing stuff
This is a simple mute command with timer:
pawn Код:
forward Unmute(playerid);

CMD:mute(playerid,params[])
{
    new toplayerid;
    if(sscanf(params,"ds",toplayerid,params) return SendClientMessage(playerid,LIGHTBLUE2,"Usage: /mute [PlayerID] [Reason]")
    else if(AccInfo[toplayerid][Muted] == true) return SendClientMessage(playerid,LIGHTBLUE2,"The player is already muted.")
    SetTimerEx("Unmuted",minute,0,"d",toplayerid);
    AccInfo[toplayerid][Muted] = true;
    return;
}

public Unmute(playerid)
{
        AccInfo[playerid][Muted] = false;
        return 1;
}
Reply
#5

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
I hate editing stuff
This is a simple mute command with timer:
pawn Код:
forward Unmute(playerid);

CMD:mute(playerid,params[])
{
    new toplayerid;
    if(sscanf(params,"ds",toplayerid,params) return SendClientMessage(playerid,LIGHTBLUE2,"Usage: /mute [PlayerID] [Reason]")
    else if(AccInfo[toplayerid][Muted] == true) return SendClientMessage(playerid,LIGHTBLUE2,"The player is already muted.")
    SetTimerEx("Unmuted",minute,0,"d",toplayerid);
    AccInfo[toplayerid][Muted] = true;
    return;
}

public Unmute(playerid)
{
        AccInfo[playerid][Muted] = false;
        return 1;
}
This didn't help me, I want the same code I got in the first post just with having the command like /Mute <PlayerID> <Minutes> <Reason>

Please someone help me

(It have to be the code that is in the first post or it wont work its because I have the admin system inside my gamemode and the command is connected with other parts in the gm.)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)