SA-MP Forums Archive
Need help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need help (/showthread.php?tid=88408)



Need help - Jakku - 26.07.2009

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.


Re: Need help - abhinavdabral - 26.07.2009

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


Re: Need help - MadeMan - 26.07.2009

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)



Re: Need help - Jakku - 26.07.2009

Thanks guys.


Re: Need help - Jakku - 26.07.2009

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


Re: Need help - abhinavdabral - 26.07.2009

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;

}




Re: Need help - Jakku - 27.07.2009

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


Re: Need help - abhinavdabral - 27.07.2009

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