Seat Detection/IsPlayerInVehicle
#1

Does IsPlayerInVehicle detect JUST if the player is a driver of a vehicle? OR does it detect if they are in a car (any seat).

Also is there a way I can detect the seat the player is in (driver, passanger)?



Thanks in advance!
Reply
#2

IsPlayerInVehicle detects any seat.

You can detect the seat by using
pawn Код:
if(IsPlayerInAnyVehicle(playerid)) // Detect if they are in any vehicle.
{
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) // User is in a vehicle, and it's not the driver seat.
    {
        // Code
    }
}
Reply
#3

I think it detects him being in every seat, but I am not that sure. I am going to test right now and tell you. Concerning the 2nd thing you ask for: https://sampwiki.blast.hk/wiki/GetPlayerVehicleSeat

Here is the correct link, sorry. And when I started writing my post, yours didn't exist.
Reply
#4

Quote:
Originally Posted by HurtLocker
Посмотреть сообщение
I think it detects him being in every seat, but I am not that sure. I am going to test right now and tell you. Concerning the 2nd thing you ask for: http://https://sampwiki.blast.hk/wiki/GetPlayerVehicleID
Lol, I already answered it.

Also, GetPlayerVehicleID? Lol...

1. It's not even a valid link.
2. That doesn't get their seat.
Reply
#5

Also, I forgot that you can use this too:
pawn Код:
new seatid = GetPlayerVehicleSeat(playerid);
// Now you can use seatid, for their seat ID.
Reply
#6

zDivine, he just tried to help.....
IsPlayerInAnyVehicle , detect only if player is in vehicle not the seat...
use state for getting seat, PLAYER_STATE_PASSANGER, PLAYER_STATE_DRIVER
Search on wiki: GetPlayerState
Reply
#7

Quote:
Originally Posted by XStormiest
Посмотреть сообщение
zDivine, he just tried to help.....
IsPlayerInAnyVehicle , detect only if player is in vehicle not the seat...
use state for getting seat, PLAYER_STATE_PASSANGER, PLAYER_STATE_DRIVER
Search on wiki: GetPlayerState
zDivine, he just tried to help.....: No.

IsPlayerInAnyVehicle , detect only if player is in vehicle not the seat...: Never said it did. (if you were saying that towards me, otherwise sorry.)

use state for getting seat, PLAYER_STATE_PASSANGER, PLAYER_STATE_DRIVER: Already said that. (And you spelled PASSENGER wrong.)

Search on wiki: GetPlayerState: Gave him a better solution. GetPlayerVehicleSeat(playerid);
Reply
#8

Thanks guys!

Everyone gets a +1 rep.

I'm going to use GetPlayerVehicleSeat(playerid); And then like it says (0 = driver , 1= front passanger and 1> = back seat passangers).

Saved me testing time!
Reply
#9

Well, I tested it and yes, IsPlayerInVehicle is trigerred even if player is not driver.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)