Magic number
#1

I need a magic numer to have the velocity of a vehicle in kph...

Код:
GetVehicleVelocity(vehicleid,speed_x,speed_y,speed_z);
		final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*MagicNumber;
Reply
#2

Return an integer :
PHP код:
GetPlayerSpeed(playerid)
{
    new
        
Float:x,
        
Float:y,
        
Float:z;
    
GetVehicleVelocity(GetPlayerVehicleID(playerid), xyz);
    return 
floatround(floatsqroot(floatpower(floatabs(x), 2.0) + floatpower(floatabs(y), 2.0) + floatpower(floatabs(z), 2.0)) * 195.28625);

EDIT: There is not a REAL magic number since each (almost) vehicle are his own ratio.
Reply
#3

There's an entire thread devoted to this: https://sampforum.blast.hk/showthread.php?tid=364124
Reply
#4

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Return an integer :
PHP код:
GetPlayerSpeed(playerid)
{
    new
        
Float:x,
        
Float:y,
        
Float:z;
    
GetVehicleVelocity(GetPlayerVehicleID(playerid), xyz);
    return 
floatround(floatsqroot(floatpower(floatabs(x), 2.0) + floatpower(floatabs(y), 2.0) + floatpower(floatabs(z), 2.0)) * 195.28625);

EDIT: There is not a REAL magic number since each (almost) vehicle are his own ratio.
Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)