tp player in front of vehicle instead of vehicle in front of player.
#1

I am creating something that if the player drives above a certain about of speed he gets flown out of the window like in GTAiv etc. This is unpossible to to with an animation i think, so i want to tp the player in front of the vehicle.
I know it is possible to do it with vehicles...

But is it also possible to revert that? so simply eject the player from the car and put them in front of the vehicle.
How would i put the player in front of the vehicle.

I think something with the player facing angle?

This is what i have now but i cant figure out how i should set the player in front of the vehicle with setplayerpos or setplayerfacingangle.

PHP код:
GetPlayerPos(playeridPlayerXPlayerYPlayerZ);
RemovePlayerFromVehicle(playerid);
GetPlayerFacingAngle(playeridFloat:Angle); 
Edit: is there also a way to make the car window break like if you shoot on it?
Reply
#2

The Break out of Windows is a no-no for sure.

On the other side set the position of the position and play with the X, Y Axis a bit

PHP код:
SetPlayerPos(playeridPlayerX 1.0PlayerYPlayerZ);// Something like this 
Just an idea nonetheless. It would definitely get the player out of the vehicle for sure.
Reply
#3

pawn Код:
enum Directions
{
    FRONT,
    LEFT,
    RIGHT,
    BEHIND,
}

stock GetXYRelativeToPos(&Float:x, &Float:y, Float:z, Float:a, Float:distance, Directions:direction = FRONT)
{
    if(direction == FRONT) a=a;
    else if(direction == BEHIND) a+=180;
    else if(direction == LEFT) a+=90;
    else if(direction == RIGHT) a+=270;

    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
}

//Then use it like
new Float:vx, Float:vy, Float:vz, Float: vr;
GetVehiclePos(vehicleid, vx, vy, vz);
GetVehicleZAngle(vehicleid, vr);
GetXYRelativeToPos(vx, vy, vz, vr, 2);
SetPlayerPos(playerid, vx, vy, vr);
Reply
#4

Quote:
Originally Posted by ISmokezU
Посмотреть сообщение
The Break out of Windows is a no-no for sure.

On the other side set the position of the position and play with the X, Y Axis a bit

PHP код:
SetPlayerPos(playeridPlayerX 1.0PlayerYPlayerZ);// Something like this 
Just an idea nonetheless. It would definitely get the player out of the vehicle for sure.
I considered that, but wouldn't that have problems with the angle? because the vehicle can have different angles.
They do it with vehicle in front of player like this:
PHP код:
GetPlayerPos(playeridFloat:XFloat:YFloat:Z);
GetPlayerFacingAngle(playeridFloat:Angle);
CreateVehicle(411XY2.0Angle 90.0, -1, -15000); 
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)