Help I am newbie
#3

You need to calculate the velocity of the vehicle when is moves and define the max speed for every single 299 vehicle on the server. Then as Mencent said, use SetVehicleHealth.


To calculate the speed:
pawn Код:
new vehicleid, Float:speed_x, Float:speed_y, Float:speed_z, Float:final_speed, speed_string[50], final_speed_int;

        // Get the vehicles velocity
        GetVehicleVelocity(vehicleid, speed_x, speed_y, speed_z);
        // Calculate the speed (in kph)
        final_speed = floatsqroot(((speed_x * speed_x) + (speed_y * speed_y)) + (speed_z * speed_z)) * 158.179;
        // Convert the float value to an int value
        final_speed_int = floatround(final_speed, floatround_round);
        // Also save the speed
        new finealspeed = final_speed_int;
To see how fast hes driving:
pawn Код:
if(vehicleid == infernus)
       {
        if ((final_speed_int > MAXSPEEDINFERNUS))
        {
                        SetVehicleHealth(vehicleid, 0);
        }
        }
This is a wery rough piece of code, and you need to tinker alot with it.
A little advice here : when you define the max speeds of vehicles, dont put it the max it goes. I mean if it goes 150, then define it to 149 or 148, also if you want to make the car slowly get damage, then use some timers.
Reply


Messages In This Thread
Help I am newbie - by rigoc - 22.06.2015, 11:06
AW: Help I am newbie - by Mencent - 22.06.2015, 11:23
Re: Help I am newbie - by Hessu - 22.06.2015, 14:21
Re: Help I am newbie - by rigoc - 22.06.2015, 14:47
Re: Help I am newbie - by rigoc - 22.06.2015, 14:50
Re : Re: Help I am newbie - by KillerDVX - 22.06.2015, 17:01

Forum Jump:


Users browsing this thread: 2 Guest(s)