Teleport to Red Marker w/ Vehicle -
kbalor - 24.06.2012
This is the teleport to marker simple script but without vehicle.
Quote:
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
SetPlayerPos(playerid, fX, fY, fZ);
return 1;
}
|
Im looking for a teleport marker with vehicle this time.
Re: Teleport to Red Marker w/ Vehicle -
Pangea - 24.06.2012
Like this:
pawn Код:
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
if(IsPlayerInAnyVehicle(playerid))
{
SetVehiclePos(playerid, fX, fY, fZ);
}
else
{
SetPlayerPos(playerid, fX, fY, fZ);
}
return 1;
}
If the player is in a vehicle, the vehicle gets teleported.
Otherwise it's just the player.
Re: Teleport to Red Marker w/ Vehicle -
Grand_Micha - 24.06.2012
Use this, this is correct.
pawn Код:
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
new Babatz = GetPlayerVehicleID(playerid);
if(!Babatz) SetPlayerPos(playerid, fX, fY, fZ);
else {new Batz = GetPlayerVehicleSeat(playerid);SetVehiclePos(Babatz,fX,fY,fZ);PutPlayerInVehicle(playerid,Babatz,Batz);}
return 1;
}
Re: Teleport to Red Marker w/ Vehicle -
kbalor - 24.06.2012
Quote:
Originally Posted by Pangea
Like this:
pawn Код:
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ) { if(IsPlayerInAnyVehicle(playerid)) { SetVehiclePos(playerid, fX, fY, fZ); } else { SetPlayerPos(playerid, fX, fY, fZ); } return 1; }
If the player is in a vehicle, the vehicle gets teleported.
Otherwise it's just the player.
|
Player cant teleport but vehicle wont. still no changes at all. You know why?
No error after compiling.
Re: Teleport to Red Marker w/ Vehicle -
Grand_Micha - 24.06.2012
It's because he used SetVehiclePos(
playerid, fX, fY, fZ);
Use this:
pawn Код:
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
new Babatz = GetPlayerVehicleID(playerid);
if(!Babatz) SetPlayerPos(playerid, fX, fY, fZ);
else {new Batz = GetPlayerVehicleSeat(playerid);SetVehiclePos(Babatz,fX,fY,fZ);PutPlayerInVehicle(playerid,Babatz,Batz);}
return 1;
}
Re: Teleport to Red Marker w/ Vehicle -
Pangea - 24.06.2012
Oh god, I failed a little hard there. My bad.
pawn Код:
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
if(IsPlayerInAnyVehicle(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);
SetVehiclePos(vehicleid, fX, fY, fZ);
}
else
{
SetPlayerPos(playerid, fX, fY, fZ);
}
return 1;
}
Re: Teleport to Red Marker w/ Vehicle -
kbalor - 24.06.2012
Quote:
Originally Posted by Grand_Micha
Use this, this is correct.
pawn Код:
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ) { new Babatz = GetPlayerVehicleID(playerid); if(!Babatz) SetPlayerPos(playerid, fX, fY, fZ); else {new Batz = GetPlayerVehicleSeat(playerid);SetVehiclePos(Babatz,fX,fY,fZ);PutPlayerInVehicle(playerid,Babatz,Batz);} return 1; }
|
thanks bro! works like a charm +rep. Do you know whats the differences of the other script given by pangea, and why it does not working but no errors at all?
Re: Teleport to Red Marker w/ Vehicle -
Pangea - 24.06.2012
I forgot to get the id of the vehicle and teleport that vehicle.
Instead of that I took the ID of the player. xD
The second one I gave would do the trick.
Re: Teleport to Red Marker w/ Vehicle -
kbalor - 24.06.2012
Quote:
Originally Posted by Pangea
Oh god, I failed a little hard there. My bad.
pawn Код:
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ) { if(IsPlayerInAnyVehicle(playerid)) { new vehicleid = GetPlayerVehicleID(playerid); SetVehiclePos(vehicleid, fX, fY, fZ); } else { SetPlayerPos(playerid, fX, fY, fZ); } return 1; }
|
I see now

haha. thanks man. +rep
Re: Teleport to Red Marker w/ Vehicle -
Grand_Micha - 24.06.2012
Yes. He used SetVehiclePos(playerid, fX, fY, fZ);
He probably meant: SetVehiclePos(GetPlayerVehicleID(playerid), fX, fY, fZ);
That would result in just your car being teleported, and you staying.