Perfect GetPlayerSpeed for MPH?
#1

I've been playing around with GetPlayerSpeed but can't get it realistic in MPH - can someone help? For the record, Infernus should go about 210 MPH

(yay my 900th post)
Reply
#2

How could we help you without showing us the code you've made so far?
Reply
#3

pawn Код:
stock GetPlayerSpeed(playerid)
{
    new Float:velocity[4];
    if(IsPlayerInAnyVehicle(playerid))
    GetVehicleVelocity(GetPlayerVehicleID(playerid),velocity[0],velocity[1],velocity[2]);
    else GetPlayerVelocity(playerid,velocity[0],velocity[1],velocity[2]);
    velocity[3] = floatsqroot(floatpower(floatabs(velocity[0]), 2.0) + floatpower(floatabs(velocity[1]), 2.0) + floatpower(floatabs(velocity[2]), 2.0)) * 97;
    return floatround(velocity[3]);
}
Reply
#4

For the record, the game's files say that the Infernus' max speed is 240 Km/h, which a little more than 149 MPH.
Reply
#5

The car is based on this:
http://en.wikipedia.org/wiki/Cizeta-Moroder_V16T
which has a top speed of 204MPH
Reply
#6

204 and/or 210mph is way too high for the Infernus's accurate top speed
What Vince said is a more believable speed for it
Reply
#7

So, 210 mph is around 340 km/h
On (most) servers, the infernus' max speed is 221 and the LSPD premier is around 177.
177 is 80 percent of 221.. 80 percent of 340 is 272. So, you want a LSPD car go 270km/h..
and what about a tractor? let's say on other servers the speed is 50km/h, which is 22% of 221.
22% of 340 is around 75, now i wouldn't say a tractor (of that model) goes 75 km/h now does it?
Reply
#8

Tractors go around 45mph in real life, which is about 70kph
Reply
#9

Quote:
Originally Posted by jameskmonger
Посмотреть сообщение
Tractors go around 45mph in real life, which is about 70kph
Sure modern tractors go that fast but like mike said
Quote:
Originally Posted by Mike_Peterson
Посмотреть сообщение
of that model
the tractor in gta-sa looks pretty old

pawn Код:
stock GetPlayerSpeed(playerid) {
    new
        Float: vX = Float: GetPlayerVehicleID(playerid),
        Float: vY,
        Float: vZ
    ;
    if(_: vX) {
        GetVehicleVelocity(_: vX, vX, vY, vZ);
    } else {
        GetPlayerVelocity(playerid, vX, vY, vZ);
    }
    vX *= vX, vY *= vY, vZ *= vZ;
    return (floatsqroot(vX + vY + vZ) * 200.0);
}
With the multiplier of 200 you get a realistic kmh (~245 infernus top speed), just divide it through 1.61 to get to mph
Reply
#10

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
just divide it through 1.61 to get to mph
No, he didn't. 1kph = 0.625mph, so you divide the result to convert it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)