[HELP]Teleport pickup that player AND car
#1

Код:
	garageoutside = CreatePickup (1273, 1, 2196.8542,2412.0093,10.8203);
	garage = CreatePickup (1272, 1, 2172.7998,2416.6609,10.8203, 0);
    
        if(pickupid == garageoutside) SetPlayerPos (playerid, 2165.5825,2416.3362,10.8203);
	if(pickupid == garage) SetPlayerPos (playerid, 2219.7261,2414.9763,10.8125);
There is one pickup inside the garage, which leads to outside spawnpoint.
And there is also a pickup outside the garage, which leads in.

What i want to know is, how do i teleport my current car and my player to the other point?
Right now, the only thing that works is when i walk into the pickup without a vehicle.

And i just realized the title was spelled wrong
It was supposed to say "[HELP]Teleport pickup that teleports player AND car"
Reply
#2

https://sampwiki.blast.hk/wiki/SetVehiclePos
Reply
#3

Vehicles can only trigger OnPlayerPickUpPickup when pickup type 14 is used.
Reply
#4

Yo tr1v long time no see.

As an addition to what tr1v said, https://sampwiki.blast.hk/wiki/Pickup_help. I'd try doing two pickups that make it work.

As for teleporting vehicles, SetVehiclePos (Look up if the player is in a vehicle first)
Reply
#5

I am not very good with these "if" things, could someone help me with the code?
Reply
#6

Код:
	
new garageoutside; //teleports from outside to inside of garage
new garage; //teleports from inside to outside of garage
new garageoutsidecars;//teleports from outside to inside of garage with vehicles
new garagecars;//teleports from inside to outside of garage with vehicles       

        garageoutside = CreatePickup (1273, 1, 2196.8542,2412.0093,10.8203);
	garage = CreatePickup (1272, 1, 2172.7998,2416.6609,10.8203, 0);
	garageoutsidecars = CreatePickup (1273, 14, 2196.8542,2412.0093,10.8203);
	garagecars = CreatePickup (1272, 14, 2172.7998,2416.6609,10.8203, 0);

        if(pickupid == garageoutside) SetPlayerPos (playerid, 2165.5825,2416.3362,10.8203);
	if(pickupid == garage) SetPlayerPos (playerid, 2219.7261,2414.9763,10.8125);
	if(pickupid == garagecars) SetVehiclePos (playerid, 2219.7261,2414.9763,10.8125);
        if(pickupid == garageoutsidecars) SetVehiclePos (playerid, 2165.5825,2416.3362,10.8203);
I can walk out, but i can't drive out.
It plays up some sound when i drive into it with car, but nothing more happens.
after that, it seems to dissapear because i dont hear any sound the second time.

maybe i need to do some kind of getvehicleid and put it in SetVehiclePos (playerid, currentid, X, Y, Z);
because right now i dont even have any vehicleid in both of that SetVehiclePos
Reply
#7

SetVehiclePos sets the position of a vehicle so you need the vehicleid, not playerid
Reply
#8

pawn Код:
// TOP
new garageoutside, garage, garageoutsiden, garagen;

// OnGameModeInit
garageoutside = CreatePickup (1273, 14, 2196.8542,2412.0093,10.8203);
garage = CreatePickup (1272, 14, 2172.7998,2416.6609,10.8203, 0);
garageoutsiden = CreatePickup (1273, 1, 2196.8542,2412.0093,10.8203);
garagen = CreatePickup (1272, 1, 2172.7998,2416.6609,10.8203, 0);

// OnPlayerPickupPickUp    
if(pickupid == garageoutside)
{
   SetPlayerPos (playerid, 2165.5825,2416.3362,10.8203);
   if(IsPlayerInAnyVehicle(playerid)) {
      new pveh = GetPlayerVehicleID(playerid);
      SetVehiclePos(pveh, 2165.5825,2416.3362,10.8203);
      PutPlayerInVehicle(pveh, 0);
   }
}
if(pickupid == garage)
{
   SetPlayerPos (playerid, 2219.7261,2414.9763,10.8125);
   if(IsPlayerInAnyVehicle(playerid)) {
      new pveh = GetPlayerVehicleID(playerid);
      SetVehiclePos(pveh, 2219.7261,2414.9763,10.8125);
      PutPlayerInVehicle(pveh, 0);
   }
}
if(pickupid == garagen)
{
   SetPlayerPos (playerid, 2219.7261,2414.9763,10.8125);
}
if(pickupid == garageoutsiden)
{
   SetPlayerPos (playerid, 2165.5825,2416.3362,10.8203);
}
WATCH It's changed
Reply
#9

dice7 i just get undefined symbol "vehicleid"
Reply
#10

Maybe because it is undefined
...

Get the players vehicleid with this
https://sampwiki.blast.hk/wiki/GetPlayerVehicleID
Reply
#11

Код:
#include <a_samp>

#define FILTERSCRIPT

new garageoutsidecars, garagecars, garageoutside, garage, telehouse, teleinhouse;

public OnFilterScriptInit()
{
	garageoutsidecars = CreatePickup (1273, 14, 2196.8542,2412.0093,10.8203);
	garagecars = CreatePickup (1272, 14, 2172.7998,2416.6609,10.8203, 0);
	garageoutside = CreatePickup (1273, 1, 2196.8542,2412.0093,10.8203);
	garage = CreatePickup (1272, 1, 2172.7998,2416.6609,10.8203, 0);
	telehouse = CreatePickup (1273, 1, 2127.4480,2378.8501,10.8203, 0);
	teleinhouse = CreatePickup (1272, 1, 2126.8457,2384.8062,10.8378, 0);
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == garageoutsidecars)
{
	SetPlayerPos (playerid, 2165.5825,2416.3362,10.8203);
	if(IsPlayerInAnyVehicle(playerid))
	{
		new pveh = GetPlayerVehicleID(playerid);
		SetVehiclePos(pveh, 2165.5825,2416.3362,10.8203);
		PutPlayerInVehicle(pveh, 0);//warning 202: number of arguments does not match definition
	}
}
if(pickupid == garagecars)
{
	SetPlayerPos (playerid, 2219.7261,2414.9763,10.8125);
	if(IsPlayerInAnyVehicle(playerid))
	{
		new pveh = GetPlayerVehicleID(playerid);
		SetVehiclePos(pveh, 2219.7261,2414.9763,10.8125);
		PutPlayerInVehicle(pveh, 0);//warning 202: number of arguments does not match definition
	}
}
if(pickupid == garage)
{
	SetPlayerPos (playerid, 2219.7261,2414.9763,10.8125);
}
if(pickupid == garageoutside)
{
   SetPlayerPos (playerid, 2165.5825,2416.3362,10.8203);
}
if(pickupid == telehouse)
{
	SetPlayerPos (playerid, 2126.5146,2388.8406,10.8378);
}
if(pickupid == teleinhouse)
{
	SetPlayerPos (playerid, 2127.5010,2375.6118,10.8203);
}
return 1;
}
2 Warnings.

What did i do wrong now?

When i try to drive out with the car, the car gets where its supposed to be, but my player ends up on the same place as the car, without being putted in the car, he just stands in the middle of it.
Reply
#12

Sorry, my bad, change those lines to:
pawn Код:
PutPlayerInVehicle(playerid,pveh, 0);
Reply
#13

Alright, it works now.
But only once :/
the second time i try to use the same pickup for cars, it happens nothing.
Reply
#14

Possibly, pickup type 14 disappears when you pick it up.

Unconfirmed though, but looking at the wiki..
https://sampwiki.blast.hk/wiki/PickupTypes
Reply
#15

Yes it doesnt say anything about "doesn't dissapear on pickup"
So i guess it just dissapears on pickup.
What do i do now?
Reply
#16

Anybody? bump
Reply
#17

You could re-create the pickup if he got it... so OnPlayerPickupPickUp and if the pickupid is garagecars/garageoutsidecars then your code and on the end you put the CreatePickup.
Reply
#18

Код:
if(pickupid == garageoutsidecars)
{
	SetPlayerPos (playerid, 2165.5825,2416.3362,10.8203);
	if(IsPlayerInAnyVehicle(playerid))
	{
		new pveh = GetPlayerVehicleID(playerid);
		SetVehiclePos(pveh, 2165.5825,2416.3362,10.8203);
		PutPlayerInVehicle(playerid,pveh, 0);
	}
	CreatePickup (1273, 14, 2196.8542,2412.0093,10.8203);//creates a new one.
}
if(pickupid == garagecars)
{
	SetPlayerPos (playerid, 2219.7261,2414.9763,10.8125);
	if(IsPlayerInAnyVehicle(playerid))
	{
		new pveh = GetPlayerVehicleID(playerid);
		SetVehiclePos(pveh, 2219.7261,2414.9763,10.8125);
		PutPlayerInVehicle(playerid,pveh, 0);
	}
	CreatePickup (1272, 14, 2172.7998,2416.6609,10.8203, 0);//creates a new one
}
It has no effect.
What did i do wrong?
Reply
#19

Bump.
What did i do wrong?
Reply
#20

Nothing, but I don't know what you need to do now, sorry
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)