Help I am newbie
#1

Help all!
I am a newbie samp scripter and would like know how to make car damage when its reach maximum speed.
Reply
#2

Hello!

You can set the health of the vehicle with this function:
https://sampwiki.blast.hk/wiki/SetVehicleHealth


- Mencent
Reply
#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
#4

Thank you,I will try it later
Reply
#5

If you don't mind please on pastebin plzzz
Reply
#6

Quote:
Originally Posted by rigoc
Посмотреть сообщение
If you don't mind please on pastebin plzzz
We aren't making scripts for you..

We should do it yourself, if you have any problems you can post them here.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)