Player Location? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Player Location? (
/showthread.php?tid=251276)
Player Location? -
RichyB - 26.04.2011
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.
Re: Player Location? -
itachi4x4 - 26.04.2011
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);
}
}
Re: Player Location? -
RichyB - 26.04.2011
Yes You sorta understand.
But I mean when the player is on the outside of the car.
Not on the inside.
Re: Player Location? -
itachi4x4 - 26.04.2011
Like when he is behind the car?
Re: Player Location? -
RichyB - 26.04.2011
yes and if his infront of it as well
Re: Player Location? -
MP2 - 26.04.2011
GetXYInfrontOfPlayer, use it on the vehicle and use IsPlayerInRangeOfPoint.
-
RichyB - 26.04.2011
GetXYInfrontOfPlayer? Never heard of that one?
Oh I got it, Umm How would I use it on a vehicleid?