How do I keep a player inside a vehicle when setplayerpos
#1

I have some teleport commands set up, but when I use the command only my player teleports and the car stays where I used the command. I need some help on bringing the car and keeping the player inside.
Reply
#2

Use the SetVehiclePos function. Then use the SetPlayerPos function. Then use the PutPlayerInVehicle function
Reply
#3

Quote:
Originally Posted by [HK]Ryder[AN]
Посмотреть сообщение
Use the SetVehiclePos function. Then use the SetPlayerPos function. Then use the PutPlayerInVehicle function
I've got
Код:
	COMMAND:lv(playerid, params[])
	{
	    SetVehiclePos(vehicleid, 2005.7919,1544.5870,13.5042)
	    SetPlayerVirtualWorld(playerid, 0);
		SetPlayerPos(playerid, 2005.7919,1544.5870,13.5042);
		PutPlayerInVehicle(playerid, vehicleid, 0);
	    SendClientMessage(playerid, COLOR_YELLOW, "You have teleported to: Las Venturas");
	    return 1;
	}
But I'm getting an error:
error 017: undefined symbol "vehicleid"
error 017: undefined symbol "vehicleid"

How do I make it so I can use vehicleid inside of the command?
Reply
#4

Quote:
Originally Posted by ExtendedCarbon
Посмотреть сообщение
I've got
...

But I'm getting an error:
error 017: undefined symbol "vehicleid"
error 017: undefined symbol "vehicleid"

How do I make it so I can use vehicleid inside of the command?
The problem here is that you have not defined vehicleid in range of that function. You're going to need that vehicleid variable inside the command's function. (Hint: https://sampwiki.blast.hk/wiki/GetPlayerVehicleID )
Reply
#5

Quote:
Originally Posted by ExtendedCarbon
Посмотреть сообщение
I've got
Код:
	COMMAND:lv(playerid, params[])
	{
	    SetVehiclePos(vehicleid, 2005.7919,1544.5870,13.5042)
	    SetPlayerVirtualWorld(playerid, 0);
		SetPlayerPos(playerid, 2005.7919,1544.5870,13.5042);
		PutPlayerInVehicle(playerid, vehicleid, 0);
	    SendClientMessage(playerid, COLOR_YELLOW, "You have teleported to: Las Venturas");
	    return 1;
	}
But I'm getting an error:
error 017: undefined symbol "vehicleid"
error 017: undefined symbol "vehicleid"

How do I make it so I can use vehicleid inside of the command?
Use the following code:

Код:
	COMMAND:lv(playerid, params[])
	{
            new vehicleid = GetPlayerVehicleID(playerid);
            if(!IsPlayerInAnyVehicle(playerid))
            {
            	SetPlayerPos(playerid, 2005.7919,1544.5870,13.5042);
	    }
            else
            {
	    	SetVehiclePos(vehicleid, 2005.7919,1544.5870,13.5042)
	    }
	    SetPlayerVirtualWorld(playerid, 0);
	    SendClientMessage(playerid, COLOR_YELLOW, "You have teleported to: Las Venturas");
	    return 1;
	}
+REP if I helped
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)