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



IsPlayerInRangeOfPoint - BGMike - 06.09.2011

Hello, I want with this function: IsPlayerInRangeOfPoint to make several positions.
But line is too long and gives me error.
So what to do ?


Re: IsPlayerInRangeOfPoint - Wesley221 - 06.09.2011

Show us the the line you used IsPlayerInRangeOfPoint in, and show us the errors


Re: IsPlayerInRangeOfPoint - Kingunit - 06.09.2011

You need to use it like this:
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 7.0, 2695.6880, -1704.6300, 11.8438))
    {
        SendClientMessage(playerid,0xFFFFFFFF,"You are near the Stadium entrance!");
    }



Re: IsPlayerInRangeOfPoint - array13 - 06.09.2011

you need to put like this:

if(IsPlayerInRangeOfPoint(playerid, (distance to the position), posx, posy, posz))


Re: IsPlayerInRangeOfPoint - BGMike - 06.09.2011

Here:

Код:
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
 if(PRESSED(KEY_HANDBRAKE) && IsPlayerInAnyVehicle(playerid))
 {
 if(IsPlayerInRangeOfPoint(playerid,15,1596.0629,2199.1621,10.8203) || IsPlayerInRangeOfPoint(playerid,15,2202.0964,2474.6543,10.8203) || IsPlayerInRangeOfPoint(playerid,15,2114.8044,919.7510,10.8203) || IsPlayerInRangeOfPoint(playerid,5,622.4417,1679.9636,6.9922) || IsPlayerInRangeOfPoint(playerid,5,618.6267,1684.9540,6.9922) || IsPlayerInRangeOfPoint(playerid,10,1382.3110,460.1322,20.3452) || IsPlayerInRangeOfPoint(playerid,5,615.3784,1689.7960,6.9922) || IsPlayerInRangeOfPoint(playerid,20,-1675.7123,413.1389,7.1797))
 {
 ShowPlayerDialog(playerid,FUELDIALOG,DIALOG_STYLE_INPUT,"{0040FF}Бензиностанция:","{80FF00}Добре дошли в бензиностанцията !\n{FFFFFF}Моля въведете колко литра искате да заредите.\n {C14124}1 литър {DEDEDE}= {00BF00}5 долара","Зареди","Излез");
 }
 }
 return 1;
}
Код:
D:\_VIDEO FILMI\Нова папка (2)\Нова папка\Нова папка\0.3c\filterscripts\speedo.pwn(209) : error 075: input line too long (after substitutions)
D:\_VIDEO FILMI\Нова папка (2)\Нова папка\Нова папка\0.3c\filterscripts\speedo.pwn(211) : error 001: expected token: ",", but found "-rational value-"
D:\_VIDEO FILMI\Нова папка (2)\Нова папка\Нова папка\0.3c\filterscripts\speedo.pwn(211) : warning 215: expression has no effect
D:\_VIDEO FILMI\Нова папка (2)\Нова папка\Нова папка\0.3c\filterscripts\speedo.pwn(211) : warning 215: expression has no effect
D:\_VIDEO FILMI\Нова папка (2)\Нова папка\Нова папка\0.3c\filterscripts\speedo.pwn(211) : error 001: expected token: ";", but found ")"
D:\_VIDEO FILMI\Нова папка (2)\Нова папка\Нова папка\0.3c\filterscripts\speedo.pwn(211) : warning 217: loose indentation
D:\_VIDEO FILMI\Нова папка (2)\Нова папка\Нова папка\0.3c\filterscripts\speedo.pwn(211) : error 029: invalid expression, assumed zero
D:\_VIDEO FILMI\Нова папка (2)\Нова папка\Нова папка\0.3c\filterscripts\speedo.pwn(211) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.



Re: IsPlayerInRangeOfPoint - Kingunit - 06.09.2011

In your code drop with '//' the lines.


Re: IsPlayerInRangeOfPoint - Kaperstone - 06.09.2011

Here:
pawn Код:
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{//1
 if((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE) && IsPlayerInAnyVehicle(playerid) // change it to whatever key you want :)
 {//2
 if(IsPlayerInRangeOfPoint(playerid,15,1596.0629,2199.1621,10.8203) || IsPlayerInRangeOfPoint(playerid,15,2202.0964,2474.6543,10.8203) || IsPlayerInRangeOfPoint(playerid,15,2114.8044,919.7510,10.8203) || IsPlayerInRangeOfPoint(playerid,5,622.4417,1679.9636,6.9922) || IsPlayerInRangeOfPoint(playerid,5,618.6267,1684.9540,6.9922) || IsPlayerInRangeOfPoint(playerid,10,1382.3110,460.1322,20.3452) || IsPlayerInRangeOfPoint(playerid,5,615.3784,1689.7960,6.9922) || IsPlayerInRangeOfPoint(playerid,20,-1675.7123,413.1389,7.1797))
 {//3
 ShowPlayerDialog(playerid,FUELDIALOG,DIALOG_STYLE_INPUT,"Blah","Buttom","Buttom");
 }//3
 }//2
 return 1;
}//1
here the list of key's that your script can detect : https://sampwiki.blast.hk/wiki/GetPlayerKeys


Re: IsPlayerInRangeOfPoint - Kyle_Olsen - 06.09.2011

Use this:
pawn Код:
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
 if(PRESSED(KEY_HANDBRAKE) && IsPlayerInAnyVehicle(playerid))
 {
 if(IsPlayerInRangeOfPoint(playerid,15,1596.0629,2199.1621,10.8203) || IsPlayerInRangeOfPoint(playerid,15,2202.0964,2474.6543,10.8203) || IsPlayerInRangeOfPoint(playerid,15,2114.8044,919.7510,10.8203) || IsPlayerInRangeOfPoint(playerid,5,622.4417,1679.9636,6.9922) ||
IsPlayerInRangeOfPoint(playerid,5,618.6267,1684.9540,6.9922) || IsPlayerInRangeOfPoint(playerid,10,1382.3110,460.1322,20.3452) ||
IsPlayerInRangeOfPoint(playerid,5,615.3784,1689.7960,6.9922) || IsPlayerInRangeOfPoint(playerid,20,-1675.7123,413.1389,7.1797))
 {
 ShowPlayerDialog(playerid,FUELDIALOG,DIALOG_STYLE_INPUT,"{0040FF}Бензиностанция:","{80FF00}Добре дошли в бензиностанцията !\n{FFFFFF}Моля въведете колко литра искате да заредите.\n {C14124}1 литър {DEDEDE}= {00BF00}5 долара","Зареди","Излез");
 }
 }
 return 1;
}



Re: IsPlayerInRangeOfPoint - Kingunit - 06.09.2011

Corrected Kyle_Olsen with some tabs.

pawn Код:
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
    if(PRESSED(KEY_HANDBRAKE) && IsPlayerInAnyVehicle(playerid))
    {
        if(IsPlayerInRangeOfPoint(playerid,15,1596.0629,2199.1621,10.8203) || IsPlayerInRangeOfPoint(playerid,15,2202.0964,2474.6543,10.8203) || IsPlayerInRangeOfPoint(playerid,15,2114.8044,919.7510,10.8203) || IsPlayerInRangeOfPoint(playerid,5,622.4417,1679.9636,6.9922) ||
        IsPlayerInRangeOfPoint(playerid,5,618.6267,1684.9540,6.9922) || IsPlayerInRangeOfPoint(playerid,10,1382.3110,460.1322,20.3452) ||
        IsPlayerInRangeOfPoint(playerid,5,615.3784,1689.7960,6.9922) || IsPlayerInRangeOfPoint(playerid,20,-1675.7123,413.1389,7.1797))
        {
            ShowPlayerDialog(playerid,FUELDIALOG,DIALOG_STYLE_INPUT,"{0040FF}Бензиностанция:","{80FF00}Добре дошли в бензиностанцията !\n{FFFFFF}Моля въведете колко литра искате да заредите.\n {C14124}1 литър {DEDEDE}= {00BF00}5 долара","Зареди","Излез");
        }
    }
    return 1;
}



Re: IsPlayerInRangeOfPoint - BGMike - 06.09.2011

Thank you Kyle_Olsen