fast question
#1

Hey guys. I have a drag command but I want it only work if the cop is near the player:
pawn Код:
if (strcmp(cmd, "/drag", true) == 0)
    {
 new giveplayerid = strval(tmp);
      if(sapd[playerid] >=1)
        {
          tmp = strtok(cmdtext, idx);
            giveplayerid = strval(tmp);
          if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_RED, "USAGE: /drag [playerid]");
                return 1;
            }
            if(!IsPlayerConnected(giveplayerid))
            {
                format(string, sizeof(string), "%d is not an active player.", giveplayerid);
                SendClientMessage(playerid,COLOR_RED, string);
                return 1;
            }
           
            if(giveplayerid == playerid)
            {
                SendClientMessage(playerid, COLOR_RED, "You cannot drag yourself!");
                return 1;
            }
            if(DragTimer[playerid] <= 0)
            {
                if(IsPlayerConnected(giveplayerid) == 1)
                {
                  GetPlayerName(giveplayerid, sendername, sizeof(sendername));
                GetPlayerName(playerid, playername, sizeof(playername));
                  format(string, sizeof(string), "Officer %s started dragging %s", playername, sendername);
                    ProxDetector(30.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED);
                    DragTimer[playerid] = SetTimerEx("Drag", 1000, 1, "ii", playerid, giveplayerid);
                    TogglePlayerControllable(giveplayerid, 0);
                    return 1;
                }
            }
  }

        else
        {
            SendClientMessage(playerid, COLOR_RED, "  You are not a Cop / FBI / Marine !");
        }
        return 1;
  }
thanks in advance
Reply
#2

Код:
if (strcmp(cmd, "/drag", true) == 0)
    {
 new giveplayerid = strval(tmp);
      if(sapd[playerid] >=1)
        {
          tmp = strtok(cmdtext, idx);
            giveplayerid = strval(tmp);
          if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_RED, "USAGE: /drag [playerid]");
                return 1;
            }
            if(!IsPlayerConnected(giveplayerid))
            {
                format(string, sizeof(string), "%d is not an active player.", giveplayerid);
                SendClientMessage(playerid,COLOR_RED, string);
                return 1;
            }
           
            if(giveplayerid == playerid)
            {
                SendClientMessage(playerid, COLOR_RED, "You cannot drag yourself!");
                return 1;
            }
            if(DragTimer[playerid] <= 0)
            {
                if(IsPlayerConnected(giveplayerid) == 1)
                {
                      new Float:x, Float:y, Float:z;
                      GetPlayerPos(giveplayerid, x, y, z);
                       if(IsPlayerInRangeOfPoint(playerid, 7.0, x, y, z))
                      {
                         GetPlayerName(giveplayerid, sendername, sizeof(sendername));
                         GetPlayerName(playerid, playername, sizeof(playername));
                         format(string, sizeof(string), "Officer %s started dragging %s", playername, sendername);
                         ProxDetector(30.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED);
                         DragTimer[playerid] = SetTimerEx("Drag", 1000, 1, "ii", playerid, giveplayerid);
                         TogglePlayerControllable(giveplayerid, 0);
                         return 1;
                     }
                     else SendClientMessage(playerid, COLOR_RED, " This player must be near you ")
                }
            }
        }

        else
        {
            SendClientMessage(playerid, COLOR_RED, "  You are not a Cop / FBI / Marine !");
        }
        return 1;
  }
Reply
#3

THankyaaaa
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)