Problems with Freeze and Unfreeze command
#9

Why do you help with so hard way? He's just a player from my server and he's a beginner? How in hell he could know what is strtok?

But ontopic: I have a solution

Look at the command line, there's that 5. That is the command length without parameters. The length of /freeze is 7, not 5. I made a fixed version, it's here

pawn Код:
if(!strcmp(cmdtext, "/freeze", true, 7))
{
  if (IsPlayerAdmin(playerid))
  {
    if(!strlen(cmdtext[8]))
    {
      SendClientMessage(playerid, COLOR_ORED, "Usage: /freeze [playerid]");
      return 1;
    }
    new ID = strval(cmdtext[8]);
    new strv[170];
    if(IsPlayerConnected(ID))
    {
      format(strv, 170, "~ You have been frozen!");
      SendClientMessage(ID,COLOR_ORANGE, strv);
      TogglePlayerControllable( ID ,0);
    }
  }
  return SendClientMessage(playerid, COLOR_RED, "You are not an admin (RCON)");
}
And unfreeze:

pawn Код:
if(!strcmp(cmdtext, "/unfreeze", true, 9))
{
  if (IsPlayerAdmin(playerid))
  {
    if(!strlen(cmdtext[10]))
    {
      SendClientMessage(playerid, COLOR_ORED, "Usage: /unfreeze [playerid]");
      return 1;
    }
    new ID = strval(cmdtext[10]);
    new strv[170];
    if(IsPlayerConnected(ID))
    {
      format(strv, 170, "~ You have been unfrozen!");
      SendClientMessage(ID,COLOR_ORANGE, strv);
      TogglePlayerControllable( ID ,1);
    }
  }
  return SendClientMessage(playerid, COLOR_RED, "You are not an admin (RCON)");
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)