[PT] Velocidade - JuniorDjjr/VehFuncs GitHub Wiki
Destinado à programadores.
Ler a velocidade realista do veículo
VehFuncs calcula a velocidade do veículo de modo realista (como explicado aqui). Se você deseja o ler este valor de velocidade para usar em seu mod cleo etc (por exemplo algum mod de velocímetro na tela), eis aqui:
Sanny Builder:
{$cleo}
const
pVehFuncs = 0@
pGetVehicleSpeedRealistic = 1@
hVeh = 10@
pVeh = 11@
fSpeed = 12@
end
if 0AA2: pVehFuncs = load_library "VehFuncs.asi"
then
if 0AA4: pGetVehicleSpeedRealistic = get_proc_address "Ext_GetVehicleSpeedRealistic" library pVehFuncs
then
0AA3: free_library pVehFuncs
else
0AA3: free_library pVehFuncs
0ACD: show_text_highpriority "~r~Fail to load 'VehFuncs.asi'. Update it." time 5000
0A93: end_custom_thread
end
else
0ACD: show_text_highpriority "~r~'VehFuncs.asi' was not found." time 5000
0A93: end_custom_thread
end
while true
wait 0
if 00DF: actor $player_actor driving
then
hVeh = actor.CurrentCar($player_actor)
0A97: pVeh = car hVeh struct
0AA7: call_function_return pGetVehicleSpeedRealistic num_params 1 pop 1 pVeh -> fSpeed
0AD1: show_formatted_text_highpriority "Speed: ~y~%.3f" time 2000 fSpeed
end
end