Need help
#1

I have a problem.

This: works correctly.
pawn Код:
if(strcmp(cmdtext, "/mute", true, 5)==0)
{
  if(!strlen(cmdtext[6]))
  {
    SendClientMessage(playerid, COLOR_ORED, "Usage: /mute [playerid]");
    return 1;
  }
  new ID = strval(cmdtext[6]);
  new pName[24], str[64];
  if(IsPlayerConnected(ID))
  {
    GetPlayerName(ID, pName, 24);
    format(str, 64, "%s has been muted!", pName);
    SendClientMessageToAll(COLOR_ORED, str);
    format(str, 64, "You have been muted!");
    SendClientMessage(ID, COLOR_ORANGE, str);
    Muted[ID] = 1;
  }
  return 1;

    }
This not, why?
pawn Код:
if(strcmp(cmdtext, "/unmute", true, 5)==0)
{
  if(!strlen(cmdtext[6]))
  {
    SendClientMessage(playerid, COLOR_ORED, "Usage: /unmute [playerid]");
    return 1;
  }
  new ID = strval(cmdtext[6]);
  new pName[24], str[64];
  if(IsPlayerConnected(ID))
  {
    GetPlayerName(ID, pName, 24);
    format(str, 64, "%s has been unmuted!", pName);
    SendClientMessageToAll(COLOR_ORED, str);
    format(str, 64, "You have been unmuted!");
    SendClientMessage(ID, COLOR_ORANGE, str);
    Muted[ID] = 0;
  }
  return 1;

    }
There is no any errors / warnings. Unmute unmutes me, not ID I want.
Reply
#2

see a silly thing

this is in your mute code
pawn Код:
if(strcmp(cmdtext, "/mute", true, 5)==0)
{
you have entered the length of command as 5 ... This is correct ...but in the unmute one ... see

pawn Код:
if(strcmp(cmdtext, "/unmute", true, 5)==0)
{
You have entered the same lenght of command here i.e. 5 ... but actually it should be 7...

see the wholly corrected unmute code
pawn Код:
if(strcmp(cmdtext, "/unmute", true, 7)==0)
{
  if(!strlen(cmdtext[8]))
  {
    SendClientMessage(playerid, COLOR_ORED, "Usage: /unmute [playerid]");
    return 1;
  }
  new ID = strval(cmdtext[8]);
  new pName[24], str[64];
  if(IsPlayerConnected(ID))
  {
    GetPlayerName(ID, pName, 24);
    format(str, 64, "%s has been unmuted!", pName);
    SendClientMessageToAll(COLOR_ORED, str);
    format(str, 64, "You have been unmuted!");
    SendClientMessage(ID, COLOR_ORANGE, str);
    Muted[ID] = 0;
  }
  return 1;

}
Hope this information would be helpful,

-Abhinav
Reply
#3

And you don't need to add that number, it can just be:

pawn Код:
if(strcmp(cmdtext, "/unmute", true)==0)
if(strcmp(cmdtext, "/mute", true)==0)
Reply
#4

Thanks guys.
Reply
#5

Oh no. It didn't help. Still same problem and I fixed that what you said. More suggestions please?
Reply
#6

dont use this thing .... i have seen it many times that commands don work when you didnt specify thier sizes ....

Just try this and nothing else and then tell me....
pawn Код:
if(!strcmp(cmdtext, "/unmute", true, 7))
{
  if(!strlen(cmdtext[8]))
  {
    SendClientMessage(playerid, COLOR_ORED, "Usage: /unmute [playerid]");
    return 1;
  }
  new ID = strval(cmdtext[8]);
  new pName[24], str[64];
  if(IsPlayerConnected(ID))
  {
    GetPlayerName(ID, pName, 24);
    format(str, 64, "%s has been unmuted!", pName);
    SendClientMessageToAll(COLOR_ORED, str);
    format(str, 64, "You have been unmuted!");
    SendClientMessage(ID, COLOR_ORANGE, str);
    Muted[ID] = 0;
  }
  return 1;

}

Reply
#7

Quote:
Originally Posted by ۞●•λвнiиаv•●۞
dont use this thing .... i have seen it many times that commands don work when you didnt specify thier sizes ....

Just try this and nothing else and then tell me....
pawn Код:
if(!strcmp(cmdtext, "/unmute", true, 7))
{
  if(!strlen(cmdtext[8]))
  {
    SendClientMessage(playerid, COLOR_ORED, "Usage: /unmute [playerid]");
    return 1;
  }
  new ID = strval(cmdtext[8]);
  new pName[24], str[64];
  if(IsPlayerConnected(ID))
  {
    GetPlayerName(ID, pName, 24);
    format(str, 64, "%s has been unmuted!", pName);
    SendClientMessageToAll(COLOR_ORED, str);
    format(str, 64, "You have been unmuted!");
    SendClientMessage(ID, COLOR_ORANGE, str);
    Muted[ID] = 0;
  }
  return 1;

}

You forgot a bracket after return 1 . And no effect. Same problem
Reply
#8

ohh...Keep trying other things ... but I havent left a bracket after retrurn ... See CLEARLY there..SCROLL DOWN A BIT in my code :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)