25.02.2013, 09:46
Hi,
I drive by the car, and when 1 sec is pass i get
* Speed: 1578 about that, but i go forward about 5 metres and when am not moving distance is about 1000-1600. But i think this have to be zero, because from last point distance don't change, please look at code, maybe you see any mistakes.
Sorry for my bad English
Code:
new Float:vPOS[ MAX_PLAYERS ][ 3 ]; public OnPlayerStateChange( playerid, newstate, oldstate ) { if( newstate == PLAYER_STATE_DRIVER ) { GetVehiclePos( GetPlayerVehicleID( playerid ), vPOS[ playerid ][ 0 ], vPOS[ playerid ][ 1 ], vPOS[ playerid ][ 1 ] ); SetTimerEx("Speed", 1000, true, "d", playerid ); } return 1; } forward Speed( playerid ); public Speed( playerid ) { new STRINGSPPEED[ 50 ]; format(STRINGSPPEED,50,"* Speed: %f",GetVehicleDistanceFromPoint(GetPlayerVehicleID( playerid ),vPOS[ playerid ][ 0 ],vPOS[ playerid ][ 1 ],vPOS[ playerid ][ 2 ] ) ); SendClientMessage( playerid, -1, STRINGSPPEED ); GetVehiclePos( GetPlayerVehicleID( playerid ), vPOS[ playerid ][ 0 ], vPOS[ playerid ][ 1 ], vPOS[ playerid ][ 1 ] ); }
* Speed: 1578 about that, but i go forward about 5 metres and when am not moving distance is about 1000-1600. But i think this have to be zero, because from last point distance don't change, please look at code, maybe you see any mistakes.
Sorry for my bad English