/Mute command doesn't work
#1

Sup!
So i was wondering why me script doesn't functional when i type /mute player_name time reason, its just always repeat the same message like if you want mute player use /mute player_name time reason and blablabla, though i type everything like name, time and reason its just doesn't work

Here me code
Код:
CMD:mute(playerid,params[])
{
    if(zInfo[playerid][AdminLevel]<2) return 0;
    new player[MAX_PLAYER_NAME],priezastis[30],time,msg[140],zaidejoID,name[MAX_PLAYER_NAME],names[MAX_PLAYER_NAME],msgss[240],msgs[40];
    if(sscanf(params,"zds",player,time,priezastis)) return InfoBoxForPlayer(playerid,"~y~Mute player ~r~/mute (Name_Name)(Sec)~n~(Reason)");
    zaidejoID = GetPlayeridMid( player );
    if(zaidejoID == playerid) return InfoBoxForPlayer(playerid,"~r~You can't mute your self.");
	if(zInfo[zaidejoID][mutelaikas]>0) return InfoBoxForPlayer(playerid,"~r~Player already muted");
    if(zaidejoID == INVALID_PLAYER_ID) return InfoBoxForPlayer(playerid,"~r~This player doesn't exist.");
    if(zInfo[playerid][Savininkas]==0)
    {
    if(zInfo[zaidejoID][AdminLevel]!=0 || zInfo[zaidejoID][Savininkas]!=0) return InfoBoxForPlayer(playerid,"~r~You can't mute admin.");
    }
    if(time > 5000) return InfoBoxForPlayer(playerid,"~y~Time to long~n~ ~r~(MAX - 5000sec).");
    GetPlayerName(playerid,name,sizeof(name));
    GetPlayerName(zaidejoID,names,sizeof(names));
    zInfo[zaidejoID][mutelaikas]+=time;
   	format(msgss,240,"[Mute] Admin %s muted player %s reason: {00CC00}%s",name,names,priezastis);
	SendClientMessageToAll(0xFF0000FF,msgss);
	format(msg,sizeof(msg),"{FF0000}You was muted: {DC00FF}%d {FF0000}sec. For {DC00FF}%s. {FF0000}You got muted be: {FFD400}%s",time,priezastis,name);
	SendClientMessage(zaidejoID,-1,msg);
	MuteTime[zaidejoID] = SetTimerEx("Mute", 1000, 1, "i", zaidejoID);
	format(msgs,sizeof(msgs),"Mute: %d sek.",zInfo[zaidejoID][mutelaikas]);
	SetPlayerChatBubble(zaidejoID, msgs, 0xFF0000FF, 20.0, 2000);
	return 1;
}
Can you say why its doesn't response?
Reply
#2

Why using playername instead of id? its much easier... anyway try this:

PHP код:
if(sscanf(params,"s[24]ds[30]",player,time,priezastis)) return InfoBoxForPlayer(playerid,"~y~Mute player ~r~/mute (Name_Name)(Sec)~n~(Reason)"); 
Reply
#3

Just use the specifier 'u' instead with an integer variable, 'u' works for both playerid and playername.
Reply
#4

Quote:
Originally Posted by iLearner
Посмотреть сообщение
Why using playername instead of id? its much easier... anyway try this:

PHP код:
if(sscanf(params,"s[24]ds[30]",player,time,priezastis)) return InfoBoxForPlayer(playerid,"~y~Mute player ~r~/mute (Name_Name)(Sec)~n~(Reason)"); 
I was using name because sometime you can lost in numbers like blended id and time bat its not big deal. Well its still stuck on this line, always send the same message
Код:
if(sscanf(params,"s[24]ds[30]",player,time,priezastis)) return InfoBoxForPlayer(playerid,"~y~Mute player ~r~/mute (Name_Name)(Sec)~n~(Reason)");
Reply
#5

Post the the command you are using.
Reply
#6

Quote:
Originally Posted by iLearner
Посмотреть сообщение
Post the the command you are using.
On the top you can see me command, or you mean something different?
Reply
#7

The exact command you use in game while testing the code.(e.g: /mute henkas 10 noreason)
Reply
#8

Well problem was that i need end code with return 0 not return 1 so now everything work, bat i got other problem its doesn't mute me.

This is me onplayertext callback
Код:
public OnPlayerText(playerid, text[])
{
	if(zInfo[playerid][mutelaikas]>0)
	{
	new msg[60];
	format(msg,sizeof(msg),"~y~Your muted for ~r~%d ~y~sec",zInfo[playerid][mutelaikas]);
	InfoBoxForPlayer(playerid,msg);
	}
	return 1;
}
Reply
#9

Anyway again with return 0; its work fine now. Close
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)