Player Location?
#1

Hey Guys

Is it possible to detect whether the playerid is at the back or the front of a vehicle?
If so, how could I do this?

Please give me any ideas if not possible.
I was thinking about scripting something so when you press shoot key when ur at back of vehicle, it would open trunk, but when ur at the front of it, it would open the bonnet.
Reply
#2

GetPlayerVehicleSeat


Maybe something like this?

pawn Код:
if(GetPlayerVehicleSeat(playerid) == 1)
            {
                //Stuff
            }
if(GetPlayerVehicleSeat(playerid) == 2)
            {
                //Stuff
            }
PS.
Dont forget under the public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) Callback.

Something like this maybe?

pawn Код:
new engine,lights,alarm,doors,bonnet,boot,objective;
if(GetPlayerVehicleSeat(playerid) == 2)
{
    if (PRESSED(KEY_FIRE))
    {
                  new lol = GetPlayerVehicleID(playerid);
                  if(lol != INVALID_VEHICLE_ID) {
                     GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
                     SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_ON,objective);
    }
}
Reply
#3

Yes You sorta understand.
But I mean when the player is on the outside of the car.
Not on the inside.
Reply
#4

Like when he is behind the car?
Reply
#5

yes and if his infront of it as well
Reply
#6

GetXYInfrontOfPlayer, use it on the vehicle and use IsPlayerInRangeOfPoint.
Reply
#7

GetXYInfrontOfPlayer? Never heard of that one?

Oh I got it, Umm How would I use it on a vehicleid?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)