17.04.2014, 21:12
How to calculate the mileage in meters. I mean how to get the amount of meters the player drove in a car
new Float[3][MAX_PLAYERS],FloatNow[MAX_PLAYERS],Float:aNow[MAX_PLAYERS],Float:actualDistance[MAX_PLAYERS],Float:newDistance[3][MAX_PLAYERS]; |
public OnPlayerUpdate(playerid) { if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { if(newDistance[0||1||2][playerid] == 0) { GetPlayerPos(playerid, newDistance[0][playerid], newDistance[1][playerid], newDistance[2][playerid]); } else { GetPlayerPos(playerid, p[0][playerid], p[1][playerid], p[2][playerid]); pNow[playerid] = p[0][playerid]+=p[1][playerid]+=p[2][playerid]; aNow[playerid] = newDistance[0][playerid]+=newDistance[1][playerid]+=newDistance[2][playerid]; actualDistance[playerid] = pNow[playerid]-=aNow[playerid]; newDistance[0&&1&&2][playerid]=0; p[0&&1&&2][playerid]=0; } } return 1; } |