SA-MP Forums Archive
IsPlayerInRangeOfPoint - 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: IsPlayerInRangeOfPoint - Problem (/showthread.php?tid=203860)



IsPlayerInRangeOfPoint - Problem - Tessar - 28.12.2010

Hey.
I've previously had a problem with this feature. The problem is now that when i get to the area i selected. Nothing happenes

pawn Код:
public PortGates(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 20, 2400.6038,-2266.5767,13.0929)) // Enter Port!
    {
    PlayerPlaySound(playerid, 1153, 0, 0, 0);
    GivePlayerMoney(playerid, -100);
    GameTextForPlayer(playerid, "~w~ You have paid $100 to go to the port!",5000,5);
    MoveObject(PORTOPEN,2405.7924804688, -2266.5617675781, 13.721887588501, 3.00);
    SetTimer("close", 6000, 0);// Gate Is Open For 6 Seconds
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED,"You Are Not In A Vehicle!");
    }
   
    if(IsPlayerInRangeOfPoint(playerid, 20, 2401.5337,-2254.5486,13.1909)) // Exit Port!
    {
    PlayerPlaySound(playerid, 1153, 0, 0, 0);
    GivePlayerMoney(playerid, -100);
    GameTextForPlayer(playerid, "~w~ You have paid $100 to pass into los santos!",5000,5);
    MoveObject(PORTOPEN1,2399.0498046875, -2259.9155273438, 13.582779884338, 3.00);
    SetTimer("close", 6000, 0);// Gate Is Open For 6 Seconds
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED,"You Are Not In A Vehicle!");
    }
    return 1;
}
Thanks


Re: IsPlayerInRangeOfPoint - Problem - willsuckformoney - 28.12.2010

Your timer for PortGates(playerid) has to be SetTimerEx("PortGates",TIMERVAL,REPEAT,"i",playeri d); because if you set a timer like this e.x

pawn Код:
public OnPlayerConnect(playerid)
{
      SetTimer("Hai",1000,false); //1second
      return 1;
}

forward Hai(playerid);
public Hai(playerid)
{
      print("Hai!");
      return 1;
} //Only playerid 0 can work on this timer.
Only playerid 0 can work on this timer.


Re: IsPlayerInRangeOfPoint - Problem - Tessar - 28.12.2010

The problem is i have
pawn Код:
public close()
{
    MoveObject(PORTCLOSED, 2405.7924804688, -2266.5617675781, 13.721887588501, 3.00);
    MoveObject(PORTCLOSED1, 2398.8774414063, -2260.0964355469, 13.832779884338, 3.00);
    return 1;
}



Re: IsPlayerInRangeOfPoint - Problem - willsuckformoney - 28.12.2010

That is because you are setting the timer when they are near the gates.

pawn Код:
public PortGates(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 20, 2400.6038,-2266.5767,13.0929)) // Enter Port!
    {
    PlayerPlaySound(playerid, 1153, 0, 0, 0);
    GivePlayerMoney(playerid, -100);
    GameTextForPlayer(playerid, "~w~ You have paid $100 to go to the port!",5000,5);
    MoveObject(PORTOPEN,2405.7924804688, -2266.5617675781, 13.721887588501, 3.00);
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED,"You Are Not In A Vehicle!");
    }
   
    if(IsPlayerInRangeOfPoint(playerid, 20, 2401.5337,-2254.5486,13.1909)) // Exit Port!
    {
    PlayerPlaySound(playerid, 1153, 0, 0, 0);
    GivePlayerMoney(playerid, -100);
    GameTextForPlayer(playerid, "~w~ You have paid $100 to pass into los santos!",5000,5);
    MoveObject(PORTOPEN1,2399.0498046875, -2259.9155273438, 13.582779884338, 3.00);
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED,"You Are Not In A Vehicle!");
    }
    SetTimer("close", 6000, 0);// Gate Is Open For 6 Seconds
    SetTimer("close", 6000, 0);// Gate Is Open For 6 Seconds
    return 1;
}



Re: IsPlayerInRangeOfPoint - Problem - Tessar - 28.12.2010

The problem is the same. When i get to the
Quote:

if(IsPlayerInRangeOfPoint(playerid, 20, 2401.5337,-2254.5486,13.1909))

Nothing happens =/
No text. No Sound. No Movement.


Re: IsPlayerInRangeOfPoint - Problem - willsuckformoney - 28.12.2010

Show your timer for PortGates.


Re: IsPlayerInRangeOfPoint - Problem - Tessar - 28.12.2010

There isn't a timer set for PortGates. I only forwarded it.


Re: IsPlayerInRangeOfPoint - Problem - willsuckformoney - 28.12.2010

That's why... Set a timer for it. Otherwise it won't work.


Re: IsPlayerInRangeOfPoint - Problem - Tessar - 28.12.2010

Thankyou Very much!. I set my timer to 5000. I hope that should do it


Re: IsPlayerInRangeOfPoint - Problem - jonnyboy - 28.12.2010

does it work or do you still have problems