IsPlayerInAnyVehicle?
#1

Hello, I need some help again, I want to teleport to Los Santos Airport but if you sit inside a car, the car will not be teleported, So how do you do if you want to car to be teleported to, Give a exemple. Newbie :]

//Al
Reply
#2

With SetVehiclePos https://sampwiki.blast.hk/wiki/SetVehiclePos

Ecko
Reply
#3

Quote:
Originally Posted by .::: [E
Ecko :::. ]
With SetVehiclePos https://sampwiki.blast.hk/wiki/SetVehiclePos

Ecko
Yeah, I tried that but I got a error then "error 017: undefined symbol "vehicleid"
How can I fix that?
Reply
#4

pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
Reply
#5

Quote:
Originally Posted by [XG
Lj ]
pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
I did something simulate that before but that did not working, tough I'll see how it's working with your exemple..
I'm on good way ;P
Reply
#6

Quote:
Originally Posted by Al_Fathead
Quote:
Originally Posted by [XG
Lj ]
pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
I did something simulate that before but that did not working, tough I'll see how it's working with your exemple..
I'm on good way ;P
It should work,what are the errors?

Ecko
Reply
#7

Quote:
Originally Posted by .::: [E
Ecko :::. ]
Quote:
Originally Posted by Al_Fathead
Quote:
Originally Posted by [XG
Lj ]
pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
I did something simulate that before but that did not working, tough I'll see how it's working with your exemple..
I'm on good way ;P
It should work,what are the errors?

Ecko
Aight, I forgot to do = before, Now it works, Thanks everyone :]
Reply
#8

use Command... (Not tested!)

Код:
	if(strcmp(cmd, "/command", true) == 0)
	{
	if(IsPlayerInAnyVehicle(playerid))
	{
	new LVehicleID;
	LVehicleID = GetPlayerVehicleID(playerid);
	SetVehiclePos(LVehicleID,PosX,PosY,PosZ);
	LinkVehicleToInterior(LVehicleID, InteriorID);
	SetPlayerFacingAngle(playerid,Angle);
	SetCameraBehindPlayer(playerid);
	SetPlayerInterior(playerid,InteriorID);
	} else {
	SendClientMessage(playerid,RED,"ERROR: You not in Vehicle!");
	}
	return 1;
	}
Reply
#9

Use
pawn Код:
if(GetPlayerState == PLAYER_STATE_DRIVER)
so only the driver will be able to teleport the vehicle and not the passangers
Reply
#10

Quote:
Originally Posted by dice7
Use
pawn Код:
if(GetPlayerState == PLAYER_STATE_DRIVER)
so only the driver will be able to teleport the vehicle and not the passangers
Not needed, Tested without that and you can't teleport as Passanger
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)