PlayerToPoint / IsPlayerInRangeOfPoint
#1

Hi, the script says always, that i am not at the position, why?

pawn Код:
if(strcmp(cmd, "/rob", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
        for(new r = 0; r < sizeof(RobInfo); r++)
        {
                if(IsPlayerInRangeOfPoint(playerid, RobInfo[r][rRaduis], RobInfo[r][rPlaceX], RobInfo[r][rPlaceY], RobInfo[r][rPlaceZ]))
                {
                   //code
                }
                else
                {
                  format(string, sizeof(string), "Du kannst hier nichts ausrauben.");
                    format(string2, sizeof(string2), "You are not at a rob place.");
                    LanguageGameTextForPlayer(playerid, string, string2,5000,3);
                    return 1;
                }
            }
        }
        return 1;
    }
Reply
#2

First i want ask you. Why you need Z for check a postion?
Reply
#3

GetPlayerPos(playerid, X, Y,Z); There are 3 coordinates to check.^^

btw: IsPlayerInRangeOfPoint(playerid, radius, x,y,z);
Reply
#4

So give

new Float:rPlaceX, Float:rPlaceY, Float:rPlaceZ;
GetPlayerPos(playerid, rPlaceX, rPlaceY, rPlaceZ);
Reply
#5

The, Coordinates are loaded from a rob.cfg
So, there are 22 Lines, with, coordinates, names etc.^^
Reply
#6

Yes but when player enter this command, you need check him coordinates and then your script check IsPlayerInRangeOfPoint
Reply
#7

That doesn't make any sense, cause IsPlayerInRangeOfPoint, check it like this.^^
Reply
#8

Do a test to see if your loaded coordinates are working properly (make sure they don't all = 0)
Reply
#9

Yes, loaded succesfully.

here:
pawn Код:
[17:17:09] Robplace: San Fierro, Trainstation X=-2026.578735, Y=157.248794, Z=29.039100

[17:17:09] Robplace: San Fierro, SFPD X=-1676.363159, Y=412.921600, Z=7.179699

[17:17:09] Robplace: San Fierro, BSN West X=-2409.881835, Y=975.729797, Z=45.379001

[17:17:09] Robplace: Angel Pine X=-2244.039794, Y=-2560.708984, Z=31.921899

[17:17:09] Robplace: Angel Pine X=-1605.166015, Y=-2714.099609, Z=48.533500

[17:17:09] Robplace: RS Haul X=-91.207099, Y=-1169.646484, Z=2.420300

[17:17:09] Robplace: Los Santos, BSN North X=1003.194885, Y=-936.698974, Z=42.328098

[17:17:09] Robplace: Los Santos, LSPD X=1940.842651, Y=-1773.338012, Z=13.390600

[17:17:09] Robplace: Dillimore X=655.703979, Y=-565.496215, Z=16.335899

[17:17:09] Robplace: Montgomery X=1381.569824, Y=459.864410, Z=20.345199

[17:17:09] Robplace: Las Venturas, Four Dragons X=2115.078369, Y=920.706970, Z=10.820300

[17:17:09] Robplace: Las Venturas, LVPD X=2203.576416, Y=2475.330078, Z=10.820300

[17:17:09] Robplace: Las Venturas, Spinybed X=2147.577636, Y=2749.245849, Z=10.820300

[17:17:09] Robplace: Las Venturas, Stadium X=1595.776489, Y=2199.499023, Z=10.820300

[17:17:09] Robplace: Las Venturas X=2640.441162, Y=1106.082885, Z=10.820300

[17:17:09] Robplace: LV, Country X=613.344116, Y=1693.142333, Z=6.992199

[17:17:09] Robplace: Fort Carson X=70.592796, Y=1218.179443, Z=18.813100

[17:17:09] Robplace: Valle Octulda X=-737.177185, Y=2744.520019, Z=47.226600

[17:17:09] Robplace: Tierra Robada X=-1328.068725, Y=2677.759765, Z=50.062500

[17:17:09] Robplace: Tierra Robada X=-1471.976318, Y=1863.724243, Z=32.632801

[17:17:09] Robplace: Valle Octulda X=-737.177185, Y=2744.520019, Z=47.226600
I have the same problems with houses, only with a timer, checkinh coordinatess works, but I want working without Timer.
Reply
#10

What i have to change, tell me pls, it is my first selfmade Role Play.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)