02.03.2012, 15:37
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)
(yay my 900th post)
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]);
}
Tractors go around 45mph in real life, which is about 70kph
|
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);
}