SA-MP Forums Archive
Player to point problem. - 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: Player to point problem. (/showthread.php?tid=86292)



Player to point problem. - arnutisz - 13.07.2009

Whats wrong with that function?
pawn Код:
stock CreateFlat(interior, Float:iX, Float:iY, Float:iZ, Float:eX, Float:eY, Float:eZ)
{
    new keys, updown, leftright;
    for(new playerid; playerid<MAX_PLAYERS; playerid++)
    {
      SetPlayerMapIcon(playerid, 12, eX, eY, eZ, 35, 0);
      if(PlayerToPoint(10.0, playerid, iX, iY, iZ))
      {
            GetPlayerKeys(playerid, keys, updown, leftright);
            if(keys == KEY_SECONDARY_ATTACK)
            {
                SetPlayerPos(playerid, eX, eY, eZ);
                SetPlayerInterior(playerid, 0);
            }
            return 1;
        }
        else if(PlayerToPoint(10.0, playerid, eX, eY, eZ))
        {
            GetPlayerKeys(playerid, keys, updown, leftright);
            if(keys == KEY_SECONDARY_ATTACK)
            {
                SetPlayerPos(playerid, iX, iY, iZ);
                SetPlayerInterior(playerid, interior);
            }
            return 1;
        }
        else return 0;
    }
    return 1;
}
And I put OnGameModeInt() tris:
pawn Код:
CreateFlat(5, -1754.087646, 964.017028, 25.390625, 2233.628173, -1115.255493, 1051.382812);
But PlayerToPoint doesn't works. Why?


Re: Player to point problem. - SpiderPork - 13.07.2009

This won't work becuase key states must be under OnPlayerKeyStateChange.
Actually it will work, but it will only check if the player is near that point and presses the button once, which, in your case, is at OnGameModeInit.