SA-MP Forums Archive
Magic number - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Magic number (/showthread.php?tid=634368)



Magic number - Antenastyle - 17.05.2017

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;



Re: Magic number - Dayrion - 17.05.2017

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.


Re: Magic number - Vince - 17.05.2017

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


Re: Magic number - Antenastyle - 17.05.2017

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