Help with mute command
#1

this is my mute command
Код:
if(strcmp(cmd,"/tmute",true) == 0)
	{
	    if(pInfo[playerid][pAdmin] >= 2)
	    {
		    new id,minutes,reason[128];
		    if(sscanf(params,"uis[128]", id, minutes, reason)) return SendClientMessage(playerid,-1,"Използвай: /tmute [playerid] [time] [reason]");
			pInfo[id][pMuted] = 1;
			pInfo[id][pMutedTime] = minutes*1;
			format(string,sizeof(string),"%s беше заглушен от администратор %s за %d минути[Причина: %s]",GetName(id),GetName(playerid),minutes,reason);
			SendClientMessageToAll(0xFF0000FF,string);
			SetTimerEx("CheckPlayerMute", 1000, 1, "d", id);
			return 1;
	    }
	    else
	    {
	        SendClientMessage(playerid, 0xFF0000FF, "Нямаш права за да ползваш командата!");
	        return 1;
	    }
	   	return 1;
	}
but when i type for example : /tmute 0 15 test it returns Използвай: /tmute [playerid] [time] [reason]
can someone help me to fix that ?
Reply
#2

Код:
if(sscanf(params,"uis", id, minutes, reason)) return SendClientMessage(playerid,-1,"Използвай: /tmute [playerid] [time] [reason]");
Just a fast look, try this.
Reply
#3

Quote:
Originally Posted by Gameluner
Посмотреть сообщение
Код:
if(sscanf(params,"uis", id, minutes, reason)) return SendClientMessage(playerid,-1,"Използвай: /tmute [playerid] [time] [reason]");
Just a fast look, try this.
Nothing...
Reply
#4

Give it a try to this

PHP код:
if(sscanf(params,"uds[128]"idminutesreason)) return SendClientMessage(playerid,-1,"Използвай: /tmute [playerid] [time] [reason]"); 
Reply
#5

Quote:
Originally Posted by Maximun
Посмотреть сообщение
Give it a try to this

PHP код:
if(sscanf(params,"uds[128]"idminutesreason)) return SendClientMessage(playerid,-1,"Използвай: /tmute [playerid] [time] [reason]"); 
Which exactly the same code (i = d)
OT: Can you show where do you get "params"?
Reply
#6

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[128], idx;
	cmd = strtok(cmdtext, idx);
	new tmp[128];
	new string[2000];
	new params[256];
	if(strcmp(cmd,"/tmute",true) == 0)
	{
	    if(pInfo[playerid][pAdmin] >= 2)
	    {
		    new id,minutes,reason[128];
		    if(sscanf(params,"uds[128]", id, minutes, reason)) return SendClientMessage(playerid,-1,"Използвай: /tmute [playerid] [time] [reason]");
			pInfo[id][pMuted] = 1;
			pInfo[id][pMutedTime] = minutes*1;
			format(string,sizeof(string),"%s беше заглушен от администратор %s за %d минути[Причина: %s]",GetName(id),GetName(playerid),minutes,reason);
			SendClientMessageToAll(0xFF0000FF,string);
			SetTimerEx("CheckPlayerMute", 1000, 1, "d", id);
			return 1;
	    }
	    else
	    {
	        SendClientMessage(playerid, 0xFF0000FF, "Нямаш права за да ползваш командата!");
	        return 1;
	    }
	   	return 1;
	}
	return 0;
}
Reply
#7

Alright, there we are. params will be always blank. You need to store the parameters from player's typed command.

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    new 
cmd[28],
        
params[100];
    
sscanf(cmdtext"s[28]S()[100]"cmdparams);
    if(
strcmp(cmd"/tmute"true) == 0)
    {
        if(
pInfo[playerid][pAdmin] < 2)
            return 
SendClientMessage(playerid0xFF0000FF"Нямаш права за да ползваш командата!"); // If the player haven't an admin level higher than 2, we return an error message.
        
new idminutesreason[100]; // The parameters will not exceed 100 characters so the reason cannot be 100 characters long. A player cannot type than more 128 characters. 28 (command) + 100 (parameters) = 128
        
if(sscanf(params,"uds[100]"idminutesreason))
            return 
SendClientMessage(playerid,-1,"Използвай: /tmute [playerid] [time] [reason]");
        
pInfo[id][pMuted] = 1;
        
pInfo[id][pMutedTime] = minutes*1;
        
format(string,sizeof(string),"%s беше заглушен от администратор %s за %d минути[Причина: %s]",GetName(id),GetName(playerid),minutes,reason);
        
SendClientMessageToAll(0xFF0000FF,string);
        
SetTimerEx("CheckPlayerMute"10001"d"id);
        return 
1;
    }
    return 
0;

Reply
#8

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Alright, there we are. params will be always blank. You need to store the parameters from player's typed command.

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    new 
cmd[28],
        
params[100];
    
sscanf(cmdtext"s[28]S()[100]"cmdparams);
    if(
strcmp(cmd"/tmute"true) == 0)
    {
        if(
pInfo[playerid][pAdmin] < 2)
            return 
SendClientMessage(playerid0xFF0000FF"Нямаш права за да ползваш командата!"); // If the player haven't an admin level higher than 2, we return an error message.
        
new idminutesreason[100]; // The parameters will not exceed 100 characters so the reason cannot be 100 characters long. A player cannot type than more 128 characters. 28 (command) + 100 (parameters) = 128
        
if(sscanf(params,"uds[100]"idminutesreason))
            return 
SendClientMessage(playerid,-1,"Използвай: /tmute [playerid] [time] [reason]");
        
pInfo[id][pMuted] = 1;
        
pInfo[id][pMutedTime] = minutes*1;
        
format(string,sizeof(string),"%s беше заглушен от администратор %s за %d минути[Причина: %s]",GetName(id),GetName(playerid),minutes,reason);
        
SendClientMessageToAll(0xFF0000FF,string);
        
SetTimerEx("CheckPlayerMute"10001"d"id);
        return 
1;
    }
    return 
0;

Thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)