/seatbelt?
#1

How should I make /seatbelt command so it would work like this: If player doesn't has buckled seatbelt and if he hit a wall with high speed he would be thrown out of car, in other case he won't be thrown out of car..?

Ty for help
Reply
#2

https://sampwiki.blast.hk/wiki/SetPlayerVelocity

Create a global timer and let him check and compare certain states of the player's velocity. If the velocity drop is too big (which means, he ran into a wall or something), you can use SetPlayerVelocity to throw the player out of the car, if he didn't put on his seat belt. Simply add the check of a boolean.
Clear the variable when the player gets out of the vehicle. (OnPlayerStateChange)
Reply
#3

Already posted, my post removed.
Reply
#4

Umm I know I can do something with SetPlayerVelocity but I don't know how ^^ may someone show the code or something? I can't say how I'm thankful for that
Reply
#5

I'm not too sure if I am much help, but you should try and download a script with /seatbelt already implemented, and read through the code. I guess that would give you a general idea of how it worked?
Reply
#6

I was searching for seatbelt with that system but I couldn't find, that's why I'm asking here
Reply
#7

https://sampforum.blast.hk/showthread.php?tid=357082

Have a look at this.
Reply
#8

Umm may someone explain me this ?
pawn Код:
public OnPlayerUpdate(playerid)
{
    if(IsPlayerInAnyVehicle(playerid) == 1 && SeatbeltStatus[playerid] == 0)
    {
        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;
    }
    return 1;
}
Reply
#9

You don't need to do anything with the velocity.

Get the vehicle's health, if it drops, remove some of the player's health.
Reply
#10

Okay this lower player's health and I like it but how can I make that player will throw out of car if he will hit wall with high speed (so there will look like he was thrown out of car through front windshield window)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)