Crashing through windshield
#5

Quote:
Originally Posted by EnzoMetlc
Посмотреть сообщение
You're throwing the player to 0.0, 0.0, 0.0. Try this:

pawn Код:
public OnPlayerCrashVehicle(playerid, vehicleid, Float:damage)
{
    new Float:x, Float:y, Float:z, Float:angle;

    GetPlayerPos(playerid, x, y, z);
    SetPlayerPos(playerid, x, y, z + 1.0);
    GetVehicleZAngle(vehicleid, angle);
    SetPlayerVelocity(playerid, x + (damage * floatsin(-angle, degrees), y + (damage * floatcos(-angle, degrees), 1.0);
    return 1;
}
That will throw the player in front of him. damage will be the distance that the player will be throwed. You can change it to a constant value if you like.

I don't tested it IG, but I've done some test about that a long time ago. So I think it will work fine
I tried this and it bugged my screen out. Maybe because you are adding player's position x and y to player's x and y velocity? But I found this https://sampforum.blast.hk/showthread.php?tid=122396 and it works perfectly.
I made it look a little bit better so this is what it looks like now:
Код:
	new Float:x, Float:y, Float:z, Float:angle;

	GetPlayerPos(playerid, x, y, z);
	SetPlayerPos(playerid, x, y, z + 2.0);

	GetVehicleZAngle(vehicleid, angle);
	SetPlayerVelocity(playerid, 0.25 * floatsin(-angle, degrees), 0.25 * floatcos(-angle, degrees), 0.0);
Thank you though.
Reply


Messages In This Thread
Crashing through windshield - by GoldenLion - 05.11.2016, 16:06
Re: Crashing through windshield - by Abagail - 05.11.2016, 16:10
Re: Crashing through windshield - by GoldenLion - 05.11.2016, 16:24
Respuesta: Crashing through windshield - by Swedky - 05.11.2016, 17:31
Re: Respuesta: Crashing through windshield - by GoldenLion - 05.11.2016, 18:09

Forum Jump:


Users browsing this thread: 3 Guest(s)