[HELP] Help Command .
#1

Hello , i have make a mute command in my mod .
but its not working !
the mute command :
PHP код:
//==============================================================================
// Mute
//==============================================================================
    
if(strcmp(cmd"/Mute"true) ==0)
    {
        if(
AccInfo[playerid][Level] >= 1)
        {
        new 
id[256],reason[256],time[256];
        
id strtok(cmdtext,idx);
        
time strtok(cmdtext,idx);
        
reason strrest(cmdtext,idx);
        if(!
strlen(id) || !strlen(time) || !strlen(reason) || !IsNumeric(time)) return SendClientMessage(playerid,white,"/Mute [id] [Time] [Reason] :щйоещ");
        if(!
IsPlayerConnected(strval(id))) return SendClientMessage(playerid,white,"аййгй жд ма озебш");
        
XaPMutePlayer(playerid, !strlen(time), !strlen(reason));
        
SendClientMessage(playerid,orange,"деа чйбм ойеи !");
        }
        else return 
SendClientMessage(playerid,red,"аъд ма бшоъ агойп вбедд осфйч тм оръ мбцт фчегд же");
        return 
1;
    } 
The Public XaPMutePlayer :
PHP код:
public XaPMutePlayer(playeridtimereason// Credit To XaP Admin Mod !
{
    if(!
IsPlayerConnected(playerid)) return 1;
    new 
string[256],ActionName[24]; GetPlayerName(playerid,ActionName,24);
    
AccInfo[playerid][Muted] = 1;
    new 
nTime[16];
    if (
time == 1format(nTime16"%d second"time);
    else if (
time == 30format(nTime16"0.5 Minute");
    else if (
time 60format(nTime16"%d seconds"time);
    else if (
time == 60format(nTime16"1 minute");
    else if (
time 60format(nTime16"%d minutes"floatdiv(time,60));
    
TimerUnMute[playerid] = SetTimerEx("UnMutePlayer", (time*1000), 0"d"playerid);
    
format(string,256,"The Player %s has been muted for %s.(Reason : %s)",ActionName,nTime,reason);
    
SendClientMessageToAll(yellow,string);
    return 
1;

its only show me this :



what I need to do ?
Help me !
Reply
#2

XaPMutePlayer(playerid, !strlen(time), !strlen(reason));

I think that line has the mistake. Try to replace it with "XaPMutePlayer(playerid, strval(time), reason);"
Reply
#3

it gives :
Код HTML:
error 035: argument type mismatch (argument 2)
Reply
#4

Quote:
Originally Posted by TeRmi[N]aTor
Посмотреть сообщение
it gives :
Код HTML:
error 035: argument type mismatch (argument 2)
I edited my last post, try again. I failed first time.
Reply
#5

The strtok is not used well.

Try this:

pawn Код:
if(strcmp(cmd, "/Mute", true) ==0)
    {
        if(AccInfo[playerid][Level] >= 1)
        {
        new id[256],reason[256],time[256];
        id = strtok(cmdtext[6],idx);
        time = strtok(cmdtext[8],idx);
        reason = strrest(cmdtext[11],idx);
        if(!strlen(id) || !strlen(time) || !strlen(reason) || !IsNumeric(time)) return SendClientMessage(playerid,white,"/Mute [id] [Time] [Reason] :щйоещ");
        if(!IsPlayerConnected(strval(id))) return SendClientMessage(playerid,white,"аййгй жд ма озебш");
        XaPMutePlayer(playerid, !strlen(time), !strlen(reason));
        SendClientMessage(playerid,orange,"деа чйбм ойеи !");
        }
        else return SendClientMessage(playerid,red,"аъд ма бшоъ агойп вбедд осфйч тм оръ мбцт фчегд же");
        return 1;
    }
Reply
#6

"nTime" is a integer not a string for starters, See if that fixes your time problem
Reply
#7

all working but ..
when im typing a number that bigger then 60 its sending me this message :



-----------------------------
Never Mind ... Works !
sorry about the english :P
Reply
#8

PHP код:
public XaPMutePlayer(playeridtimereason// Credit To XaP Admin Mod ! 

    if(!
IsPlayerConnected(playerid)) return 1;
    new 
string[256],ActionName[24]; GetPlayerName(playerid,ActionName,24); 
    
AccInfo[playerid][Muted] = 1
    new 
nTime[16]; 
    
nTime time;
    if(
time == 1)
    {
        
format(string256"The player %s has been muted for %d second.(Reason: %s)"ActionNamenTimereason);
    }
    else if(
time <= 59 && >= 2)
    {
        
format(string256"The player %s has been muted for %d seconds.(Reason: %s)"ActionNamenTimereason);
    }
    else if(
time >= 60)
    {
        
format(string256"The player %s has been muted for %d seconds.(Reason: %s)"ActionNamenTimereason);
    }
    
TimerUnMute[playerid] = SetTimerEx("UnMutePlayer", (time*1000), 0"d"playerid); 
    
SendClientMessageToAll(yellow,string); 
    return 
1

give that a try, its not built the same way as you did, but it should work.
Reply
#9

pawn Код:
else if (time > 60) format(nTime, 16, "%d minutes", floatdiv(time,60));
replace with
pawn Код:
else if (time > 60) format(nTime, 22, "%d minutes and %d sec", time/60, time%60);
I think this sholud work.

EDIT: changed 16 to 22
Reply
#10

i have changed it to :
%.1f

and its works fine ..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)