Help I am newbie - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help I am newbie (
/showthread.php?tid=578795)
Help I am newbie -
rigoc - 22.06.2015
Help all!
I am a newbie samp scripter and would like know how to make car damage when its reach maximum speed.
AW: Help I am newbie -
Mencent - 22.06.2015
Hello!
You can set the health of the vehicle with this function:
https://sampwiki.blast.hk/wiki/SetVehicleHealth
- Mencent
Re: Help I am newbie -
Hessu - 22.06.2015
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.
Re: Help I am newbie -
rigoc - 22.06.2015
Thank you,I will try it later
Re: Help I am newbie -
rigoc - 22.06.2015
If you don't mind please on pastebin plzzz
Re : Re: Help I am newbie -
KillerDVX - 22.06.2015
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.