PDA

View Full Version : Detect falling bike


weex
16/02/2017, 07:41 PM
I need some help to detect if play fall from a bike...

On this way i detect splat (on bike too sometimes)
But only sometimes and damage is too slow, i want to make like GTA V, sometimes you fall from bike and die...

Someone know how to help me?

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if(weaponid == 54) { // splat
new damage = floatround(amount);
damage = damage * 5;
health[playerid] -= damage;
}

Luis-
16/02/2017, 07:56 PM
You're not actually setting the players health when they fall off.

Sew_Sumi
16/02/2017, 08:17 PM
OnPlayerExitVehicle shouldn't be called, but the player state will change.

JesterlJoker
16/02/2017, 10:56 PM
I need some help to detect if play fall from a bike...

On this way i detect splat (on bike too sometimes)
But only sometimes and damage is too slow, i want to make like GTA V, sometimes you fall from bike and die...

Someone know how to help me?

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if(weaponid == 54) { // splat
new damage = floatround(amount);
damage = damage * 5;
health[playerid] -= damage;
}

you should have considered that OnPlayerTakeDamage already calls the damage through Float:amount;

You should also consider the speed of your vehicle, the faster the speed the bigger the damage and since you are considering GTA V here comes your bigger challenge.

The roll damage. Each roll have an equivalent damage to the players health on GTA V, it is affected by speed and bodypart that got hit and a tiny little bit of friction, it is not noticeable but falling on dirt ground and on conrete ground had a small difference that really is unnoticeable.

calculate car speed, fall speed(including gravity, since GTA V has that) and some other damages that can occur during land and roll.

that sounds scary,
scary yes but doable.

goodluck.

weex
22/02/2017, 03:57 AM
I've tried this:

if(weaponid == 54) {
amount += ((GetPlayerSpeed(playerid, true)));
new danoqueda = floatround(amount);
vida[playerid] -= danoqueda;
}


But damage caused was 11000000...
wtf