SA-MP Forums Archive
[HELP] PlayerToPoint - 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: [HELP] PlayerToPoint (/showthread.php?tid=187715)



[HELP] PlayerToPoint - joeri55 - 04.11.2010

I've got a question, does anyone maybe knows why this ain't working?

This is my code:
Код:
public IsAtEnter(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerToPoint(2.0,playerid,1836.0175,-1665.8116,-13.6735) || PlayerToPoint(2,playerid,1772.3770,-1548.2623,9.9063) || PlayerToPoint(2,playerid,1828.5704,-1666.0487,-13.6735) || PlayerToPoint(2,playerid,1833.5308,-1665.9100,-13.6735) || PlayerToPoint(2,playerid,1843.3695,-1665.9357,-13.6735) || PlayerToPoint(2,playerid,1830.8729,-1666.1912,-13.6735))
        {
            GameTextForPlayer(playerid, "~g~/enter", 5000, 1);
            return 1;
        }
    }
    return 0;
}
I've made some doors and I want that when you're infront of that door you will get a /enter sign.. But this ain't working? Anyone has a solution?


Re: [HELP] PlayerToPoint - armyoftwo - 04.11.2010

you use it under a timer?


Re: [HELP] PlayerToPoint - joeri55 - 04.11.2010

No I ain't using a timer at all for that. I just want that if the person is at those cordinates the /enter appears.


Re: [HELP] PlayerToPoint - armyoftwo - 04.11.2010

you need to use a timer/callback in order to show the gametext for a player


Re: [HELP] PlayerToPoint - joeri55 - 04.11.2010

So how do I create a timer for it?


Re: [HELP] PlayerToPoint - armyoftwo - 04.11.2010

Код:
forward IsAtEnter();
public IsAtEnter()
{
  for(new playerid = 0; playerid <= MAX_PLAYERS; playerid++)
  {
    if(IsPlayerConnected(playerid))
    {
        if(PlayerToPoint(2.0,playerid,1836.0175,-1665.8116,-13.6735) || PlayerToPoint(2,playerid,1772.3770,-1548.2623,9.9063) || PlayerToPoint(2,playerid,1828.5704,-1666.0487,-13.6735) || PlayerToPoint(2,playerid,1833.5308,-1665.9100,-13.6735) || PlayerToPoint(2,playerid,1843.3695,-1665.9357,-13.6735) || PlayerToPoint(2,playerid,1830.8729,-1666.1912,-13.6735))
        {
            GameTextForPlayer(playerid, "~g~/enter", 5000, 1);
            return 1;
        }
    }
  }
  return 0;
}
under ongamemodeinit
Код:
    SetTimer("IsAtEnter", 1000, 1);
It will check every second if a player is in that point, you can rescript it more efficent tho


Re: [HELP] PlayerToPoint - joeri55 - 04.11.2010

Thanks man, I fixed it because of you!