02.09.2009, 20:12
Finally the Velocity functions are here.
(edited)
Example usage:
Returned values seems real.
Код:
stock GetPlayerSpeed(playerid,bool:kmh) // by misco { new Float:Vx,Float:Vy,Float:Vz,Float:rtn; if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),Vx,Vy,Vz); else GetPlayerVelocity(playerid,Vx,Vy,Vz); rtn = floatsqroot(floatabs(floatpower(Vx + Vy + Vz,2))); return kmh?floatround(rtn * 100 * 1.61):floatround(rtn * 100); }
Example usage:
Код:
if (!strcmp("/myspeed", cmdtext, true)) { new str[128]; format(str,128,"My speed is %d km/h and %d mph !",GetPlayerSpeed(playerid,true),GetPlayerSpeed(playerid,false)); SendClientMessage(playerid,0xFFFFFFAA,str); return 1; }