Increasing vehicle's speed.
#1

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?
Reply
#2

Yes,

GetPlayerVelocity and SetPlayerVelocity.

Velocity = Speed
Reply
#3

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);
        }
}
Reply
#4

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

:facepalm:
Reply
#5

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

:facepalm:
Acha :P Nerd.

Тhank you for this :P.
Reply
#6

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.
Reply
#7

https://sampforum.blast.hk/showthread.php?tid=179089
Reply
#8

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? :/
Reply
#9

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
Reply
#10

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)