Increasing vehicle's speed. -
VerticalGaming - 10.04.2014
Hello,
Is it possible to edit a vehicle his speed?
For example.
Standard: Infernus goes 205km/h.
But can I let it go 400km/h?
If yes, how?
Re: Increasing vehicle's speed. -
Bingo - 10.04.2014
Yes,
GetPlayerVelocity and SetPlayerVelocity.
Velocity = Speed
Re: Increasing vehicle's speed. -
SyntaxQ - 10.04.2014
You can do that by adding nitro/speed boost..
Here is an example code to help you out:
pawn Код:
// OnPlayerKeyStateChange
if(newkeys & KEY_FIRE)
{
if (IsPlayerInAnyVehicle(playerid))
{
new Float:vx, Float:vy, Float:vz;
AddVehicleComponent(GetPlayerVehicleID(playerid), 1010); // Ignore this line if you don't want the nitro component to appear..
GetVehicleVelocity(GetPlayerVehicleID(playerid), vx, vy, vz);
SetVehicleVelocity(GetPlayerVehicleID(playerid) ,vx * 1.5,vy * 1.5 ,vz * 1.5);
}
}
Re: Increasing vehicle's speed. -
RajatPawar - 10.04.2014
Quote:
Originally Posted by [vTc]Patroool
Yes,
GetPlayerVelocity and SetPlayerVelocity.
Velocity = Speed
|
Being a science student, I can't ignore that comment. Sorry for the nerdiness, but velocity is a vector, speed's not. The correct statement is -
Velocity = | speed |
where ' | ' represents the magnitude
![Smiley](images/smilies/smile.png)
:facepalm:
Re: Increasing vehicle's speed. -
Bingo - 10.04.2014
Quote:
Originally Posted by Rajat_Pawar
Being a science student, I can't ignore that comment. Sorry for the nerdiness, but velocity is a vector, speed's not. The correct statement is -
Velocity = | speed |
where ' | ' represents the magnitude
![Smiley](images/smilies/smile.png) :facepalm:
|
Acha :P Nerd.
Тhank you for this :P.
Re: Increasing vehicle's speed. -
VerticalGaming - 10.04.2014
I've checked the velocity.
When driving 83km/h (Max speed, and shown like this on the speedometer).
I got this data:
X: -0.516280
Y: 0.017158
Z: 0.000001
Now, How can I make it like, the kart (vehicle name: kart[0]) will maximum drive 30km/h.
kart[1] maximum 50km/h
& kart[3] will be speeded up to 400km/h.
Kind regards, VerticalGaming.
Re: Increasing vehicle's speed. -
Konstantinos - 10.04.2014
https://sampforum.blast.hk/showthread.php?tid=179089
Re: Increasing vehicle's speed. -
VerticalGaming - 10.04.2014
Quote:
Originally Posted by Konstantinos
|
Merged the filterscript in the gamemode.
Anyways.
Now I've this.
pawn Код:
public OnPlayerEnterVehicle( playerid, vehicleid, ispassenger )
{
if ( vehicleid == kart[0] || vehicleid == kart[1]){SetPlayerSpeedCap( playerid, 0.4 );}
else if ( vehicleid == kart[2] || vehicleid == kart[3] || vehicleid == kart[4] || vehicleid == kart[5] || vehicleid == kart[6] || vehicleid == kart[7])
{
SetPlayerSpeedCap( playerid, 0.4 );
}
else DisablePlayerSpeedCap( playerid );
}
How to calculate the amount?
If MAX SPEED = 100
And Speedcap = 0.1
The max speed will be 10?
Or something else? :/
Re: Increasing vehicle's speed. -
Konstantinos - 10.04.2014
According to Slice:
Quote:
Originally Posted by Slice
An example of a value that feels like 50 km/h is 0.3
|
So do the maths:
50 0.3
100 x
...
x = 0.6
Re: Increasing vehicle's speed. -
VerticalGaming - 10.04.2014
50 x 0.3
0.3 / 50 = 0,006
So 30 km = 0.18?
EDIT;
Got it working.
Perfect.
Now, how can I make a vehicle going faster?