SA-MP Forums Archive
Vehicle(without player) InRangeOfPoint? - 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: Vehicle(without player) InRangeOfPoint? (/showthread.php?tid=167162)



Vehicle(without player) InRangeOfPoint? - [DRD]Rodney - 11.08.2010

Is there any function like this?
I want to make some kind of teleporter.
pawn Code:
for (new x;x<3000;x++)
{
    if (IsPlayerInDynamicCP(x,CheckPT[playerid])) SetPlayerPos(x,X+random(2)-random(4),Y+random(2)-random(4),Z);
    GetVehiclePos(x,XZ,YZ,ZZ);
    /*Got stuck here :[*/
}
(otherwise just post the formula :])


Re: Vehicle(without player) InRangeOfPoint? - [DRD]Rodney - 11.08.2010

bumpzor plz respond


Re: Vehicle(without player) InRangeOfPoint? - Kar - 11.08.2010

what si 3000?

what are you trying to do?


Re: Vehicle(without player) InRangeOfPoint? - [DRD]Rodney - 11.08.2010

Making a teleport command,

I used 3000 bcuse of all cars (i know limit is with 2k, just to be sure :])

All cars inside CheckPT[playerid] (Checkpoint)

Must be teled, But the cars are without players, But there are no functions of IsVehicleInRangeOfPoint() or IsVehicleInDynamicCP()

So I asked here, (IsPlayerToPoint, that function could help me too)


Re: Vehicle(without player) InRangeOfPoint? - Cameltoe - 11.08.2010

Lol, you know the limit is 2k still you want the code to execute 1000 times more just to be on the safe side x)? makes sense to me.


Re: Vehicle(without player) InRangeOfPoint? - Sergei - 11.08.2010

Quote:
Originally Posted by [DRD]Rodney
View Post
I used 3000 bcuse of all cars (i know limit is with 2k, just to be sure :])
What are retarded thought. Like I would be buying a car which would cost $2000 and I would pay $3000 just to be sure. And you are looping players there not cars.


Re: Vehicle(without player) InRangeOfPoint? - [DRD]Rodney - 11.08.2010

I can loop players and cars at same time <.<
There just ID's assigned to cars, same for players :/


Re: Vehicle(without player) InRangeOfPoint? - [XST]O_x - 11.08.2010

pawn Code:
forward IsVehicleInRangeOfPoint(vehicleid,Float:Range,Float:x,Float:y,Float:z);
public IsVehicleInRangeOfPoint(vehicleid,Float:Range,Float:x,Float:y,Float:z)
{
    new Float:vx,Float:vy,Float:vz;
    GetVehiclePos(vehicleid,vx,vy,vz);
    return ((((vx-x)*(vx-x))+((vy-y)*(vy-y))+((vz-z)*(vz-z)) ) >= Range*Range );
}
As for the stock,but you can't use one loop for vehicles and players.


Re: Vehicle(without player) InRangeOfPoint? - [DRD]Rodney - 11.08.2010

Why not? There just NUMBERS

ID 0 of player is first connected player
ID 0 of car is first connected car

etc...

and thx :]