Seatbelt..
#1

Why this reduces player's health only for like 5 HP points.. How can I make it it will reduce players health based on how much damage vehicle recieved at crash?

pawn Код:
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
    if(SeatBelt[playerid] ==0)
    {
        new Float:phealth;
        new Float:vhealth;
        GetPlayerHealth(playerid, phealth);
        new veh = GetPlayerVehicleID(playerid);
        GetVehicleHealth(veh, vhealth);
        SetPlayerHealth(playerid, phealth - vhealth /168);
    }
    return 1;
}
Reply
#2

Save it somewhere and compare it.
Reply
#3

How?
Reply
#4

pawn Код:
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
    if(SeatBelt[playerid] ==0)
    {
        new Float:phealth;
        new Float:vhealth;
        GetPlayerHealth(playerid, phealth);
        new veh = GetPlayerVehicleID(playerid);
        GetVehicleHealth(veh, vhealth);
        SetPlayerHealth(playerid, phealth - vhealth /168);//Vehicle got 1000HP so 1000/168 = 5.95 and this is your problem
    }
    return 1;
}
Reply
#5

Quote:
Originally Posted by Matess
Посмотреть сообщение
pawn Код:
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
    if(SeatBelt[playerid] ==0)
    {
        new Float:phealth;
        new Float:vhealth;
        GetPlayerHealth(playerid, phealth);
        new veh = GetPlayerVehicleID(playerid);
        GetVehicleHealth(veh, vhealth);
        SetPlayerHealth(playerid, phealth - vhealth /168);//Vehicle got 1000HP so 1000/168 = 5.95 and this is your problem
    }
    return 1;
}
Lowered it to 50 and it's somehow better but it's always same damage how can I make it based on how much vehicle received damage ? and if someone can show a code or something I wasn't scripting with those things yet ^^
Reply
#6

Can someone show code how can I make that player receive damage based on how much vehicle took damage at crash? Please
Reply
#7

Quote:
Originally Posted by Lajko1
Посмотреть сообщение
Can someone show code how can I make that player receive damage based on how much vehicle took damage at crash? Please
Use this under OnPlayerUpdate or change it and use it OnVehicleDamageStatusUpdate
pawn Код:
if(IsPlayerInAnyVehicle(playerid) == 1 && Seatbelt[playerid] == 0 && !IsBicycle(vehicleid))
    {
        new Float:TempCarHealth;
        GetVehicleHealth(GetPlayerVehicleID(playerid), TempCarHealth);
        new Float:Difference = floatsub(CarHealth[playerid], TempCarHealth);
        if((floatcmp(CarHealth[playerid], TempCarHealth) == 1) && (floatcmp(Difference,100.0) == 1))
        {
            Difference = floatdiv(Difference, 10.0);
            new Float:OldHealth;
            GetPlayerHealth(playerid, OldHealth);
            SetPlayerHealth(playerid, floatsub(OldHealth, Difference));
        }
        CarHealth[playerid] = TempCarHealth;
    }
    else
    {
        CarHealth[playerid] = 0.0; //To aviod that a player dies when he enters a vehicle
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)