SA-MP Forums Archive
PlayerToPoint Errors on a new command - 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: PlayerToPoint Errors on a new command (/showthread.php?tid=133495)



PlayerToPoint Errors on a new command - Souvlaki - 12.03.2010

Once I add this command to my gamemode I get unlimited "PlayerToPoint" errors o ra lot of lines
Код:
...\gamemodes\breakdownls.pwn(line) : error 004: function "PlayerToPoint" is not implemented
Any ideas what it can be?When I remeve the command it complies like charm.Thanks in advance

Under my variables
pawn Код:
new DragTimer[MAX_PLAYERS];
Under OnPlayerCommandText
pawn Код:
if (strcmp(cmd, "/drag", true) == 0)
    {
      if(gTeam[playerid] == 2 || IsACop(playerid))
        {
          tmp = strtok(cmdtext, idx);
            giveplayerid = strval(tmp);
          if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /drag [playerid]");
                return 1;
            }
            if(!IsPlayerConnected(giveplayerid))
            {
                format(string, sizeof(string), "%d is not an active player.", giveplayerid);
                SendClientMessage(playerid,COLOR_GREY, string);
                return 1;
            }
            if(GetDistanceBetweenPlayers(playerid,giveplayerid) > 3)
            {
                SendClientMessage(playerid, 0xFF0000AA, "You are too far away from that player.");
            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_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    DragTimer[playerid] = SetTimerEx("Drag", 1000, 1, "ii", playerid, giveplayerid);
                    TogglePlayerControllable(giveplayerid, 0);
                    return 1;
                }
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "  You are not a Cop or an FBI Agent!!");
        }
        return 1;
    }

    if (strcmp(cmd, "/stopdrag", true) == 0)
    {
      tmp = strtok(cmdtext, idx);
        giveplayerid = strval(tmp);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /stopdrag [playerid]");
            return 1;
        }
      if(gTeam[playerid] == 2 || IsACop(playerid))
        {
            if(DragTimer[playerid] >= 0)
            {
              if(PlayerCuffed[giveplayerid] == 1)
                {
                    TogglePlayerControllable(giveplayerid, 0);
                }
              GetPlayerName(giveplayerid, sendername, sizeof(sendername));
            GetPlayerName(playerid, playername, sizeof(playername));
              format(string, sizeof(string), "Officer %s stopped dragging %s", playername, sendername);
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                KillTimer(DragTimer[playerid]);
                DragTimer[playerid] = 0;
                TogglePlayerControllable(giveplayerid, 1);
                return 1;
            }
    }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "  You are not a Cop or an FBI Agent !");
        }
        return 1;



Re: PlayerToPoint Errors on a new command - bilakispa - 12.03.2010

Probably you don't have the PlayerToPoint function.

Copy it.
pawn Код:
stock PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
  new Float:oldposx, Float:oldposy, Float:oldposz;
  new Float:tempposx, Float:tempposy, Float:tempposz;
  GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  tempposx = (oldposx -x);
  tempposy = (oldposy -y);
  tempposz = (oldposz -z);
  if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  {
    return 1;
  }
  return 0;
}



Re: PlayerToPoint Errors on a new command - Souvlaki - 12.03.2010

Quote:
Originally Posted by bilakispa
Probably you don't have the PlayerToPoint function.

Copy it.
pawn Код:
stock PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
  new Float:oldposx, Float:oldposy, Float:oldposz;
  new Float:tempposx, Float:tempposy, Float:tempposz;
  GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  tempposx = (oldposx -x);
  tempposy = (oldposy -y);
  tempposz = (oldposz -z);
  if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  {
    return 1;
  }
  return 0;
}
I have it.I am already using it on a lot of fuctions in the gamemode...


Re: PlayerToPoint Errors on a new command - bilakispa - 12.03.2010

Then check if it is missing a } on the lastest additions you've done.

P.S. Got it, put a } in the end, is missing from
pawn Код:
if (strcmp(cmd, "/stopdrag", true) == 0)



Re: PlayerToPoint Errors on a new command - Souvlaki - 12.03.2010

I had actually forgot to put the "}" at the and of the command.Thanks