Get another player speed
#1

Hey guys i want to ask you smth look if i want to get other player speed from my car how can i do it ? Example player driving a car i am policemen with my job car when player drive next to my in gamemodetext would be writing players speed is... Is it possible to do ?
Reply
#2

Never seen something like that in my SA-MP career, but i believe its possible if you got a speedometer.You can make it check the speed on speedometer of other players.I also believe if the player is a suspect, you can make a function for suspects from which you'll be possible to make that.
Reply
#3

Hello.
You must use "GetPlayerSpeed" function and to check if your position is in range of a player.
To go throw all the players you must use "foreach", and after that i think it is very easy to
make a system that shows you automatically the player speed that who passed next to you.
Also, you must use timers all the time to check if the players are in vehicls too or if a cop that
is in a vehicle is in range of another players.

PHP код:
stock GetPlayerSpeedplayeridbool:kmh )
{
    new 
Float:xFloat:yFloat:zFloat:rtn;
    if( 
IsPlayerInAnyVehicleplayerid ) )
        
GetVehicleVelocityGetPlayerVehicleIDplayerid ), xy);
    else
        
GetPlayerVelocityplayeridxy);
    
rtn floatsqrootfloatabsfloatpowerz2) ) );
    return 
kmh?floatroundrtn 100 1.61 ):floatroundrtn 100 );

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)