SA-MP Forums Archive
Vehicle Speed - 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: Vehicle Speed (/showthread.php?tid=597308)



Vehicle Speed - AndreiWow - 29.12.2015

How do I make if the vehicle speed raise it will change the color of the speedo?

Like green until 50 then yellow until 80 then red?


Re: Vehicle Speed - xTURBOx - 29.12.2015

set a timer to call to check for the vehicle's speed and then set it to the desired colour if the required speed is match
PHP код:
#define MPH_KMH 1.609344 
stock GetVehicleSpeedvehicleid 

    new 
        
Float:x
        
Float:y
        
Float:z
        
vel
    
GetVehicleVelocityvehicleidxy); 
    
vel floatroundfloatsqrootx*y*z*) * 180 );           // KM/H 
//  vel = floatround( floatsqroot( x*x + y*y + z*z ) * 180 / MPH_KMH ); // Mph 
    
return vel




Re: Vehicle Speed - jlalt - 29.12.2015

Show us how you're getting vehicle speed and how showing it, then we will be able to realase code match with it