Moving vehicle to set coordinates. -
iOwnMyKnife - 29.06.2015
Say I've got a place in mind(Call it place A - The red mark on the screen):
I have got the coordinates of that place(x,y,z).
And there is another place(Place B):
I also have this place's coordinates.
I'm driving a boat. I'd like to get to Place B from Place A driving, automatically.
Not teleporting though.
I'd like the boat to automatically drive on the press of a button to specific coordinates I set beforehand with some kind of a program, which I could use In Game. Perhaps by just marking the place on the map like I did.
Is that possible? Do you know or can make a program which does that?
Re: Moving vehicle to set coordinates. -
kyriakos587 - 29.06.2015
public OnPlayerUpdate(playerid)
{
if(IsPlayerInRangeOfPoint(playerid,3.0,x,y,z,)) //Replace x,y,z with the coordinates of Place A
{
new car[MAX_PLAYERS];
SetPlayerPos(playerid,x,y,z);//Replace x,y,z with the coordinates of Place B
car[playerid] = SetVehiclePos(BoatID,x,y,z);//Replace BoatID with the boat id you want and x,y,z with Place B
PutPlayerInVehicle(playerid,car[playerid],0);
}
}
Re: Moving vehicle to set coordinates. -
iTakelot - 29.06.2015
Quote:
Originally Posted by kyriakos587
public OnPlayerUpdate(playerid)
{
if(IsPlayerInRangeOfPoint(playerid,3.0,x,y,z,)) //Replace x,y,z with the coordinates of Place A
{
new car[MAX_PLAYERS];
SetPlayerPos(playerid,x,y,z);//Replace x,y,z with the coordinates of Place B
car[playerid] = SetVehiclePos(BoatID,x,y,z);//Replace BoatID with the boat id you want and x,y,z with Place B
PutPlayerInVehicle(playerid,car[playerid],0);
}
}
|
the same friend of the above code more optimized
Код:
if(IsPlayerInRangeOfPoint(playerid,3.0,x,y,z,)) {
new car[MAX_PLAYERS];
SetPlayerPos(playerid,x,y,z);//Replace x,y,z with the coordinates of Place B
car[playerid] = SetVehiclePos(BoatID,x,y,z);//Replace BoatID with the boat id you want and x,y,z with Place B
PutPlayerInVehicle(playerid,car[playerid],0);
}
}
Re: Moving vehicle to set coordinates. -
nezo2001 - 29.06.2015
This will teleport the player to the other place he want to see the ride
Re: Moving vehicle to set coordinates. -
iOwnMyKnife - 30.06.2015
I want to actually see the ride, correct. How can I NOT teleport and do that?
Re: Moving vehicle to set coordinates. -
Suicidal.Banana - 30.06.2015
You could script it with some clever tricks.
- Use
this to make the player spectate the boat
- Use
this plugin to spawn an npc with same skin as player, put him in the driver seat of the boat
- Have the npc steer the boat to where ever you want it to go, if im not mistaken you could even have multiple waypoints for a more scenic route :P
- When reaching destination (or player cancels automatic-boat) just destroy the npc and put the player back in the boat