SA-MP Forums Archive
Seat Detection/IsPlayerInVehicle - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Seat Detection/IsPlayerInVehicle (/showthread.php?tid=431755)



Seat Detection/IsPlayerInVehicle - jakejohnsonusa - 19.04.2013

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!


Re: Seat Detection/IsPlayerInVehicle - zDivine - 19.04.2013

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
    }
}



Re: Seat Detection/IsPlayerInVehicle - HurtLocker - 19.04.2013

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.


Re: Seat Detection/IsPlayerInVehicle - zDivine - 19.04.2013

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.


Re: Seat Detection/IsPlayerInVehicle - zDivine - 19.04.2013

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



Re: Seat Detection/IsPlayerInVehicle - XStormiest - 19.04.2013

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


Re: Seat Detection/IsPlayerInVehicle - zDivine - 19.04.2013

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);


Re: Seat Detection/IsPlayerInVehicle - jakejohnsonusa - 19.04.2013

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!


Re: Seat Detection/IsPlayerInVehicle - HurtLocker - 19.04.2013

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