Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Em Construção
- // Pare de olhar ou seus olhos pegaram fogo :s
- #include <a_samp>
- #define iMaxRoadPoint 120
- #define iMaxRoadings 018
- new iRoads[iMaxRoadings][3] =
- {
- {5, 84, 10},
- {1, 2, 21},
- {2, 1, 12},
- {3, 4, 32},
- {4, 0, 28},
- {5, 8, 74},
- {6, 10, 7},
- {7, 0, 11},
- {8, 22, 12},
- {9, 44, 22},
- {10, 11, 14},
- {11, 11, 4},
- {12, 13, 0},
- {13, 1, 1},
- {14, 8, 2},
- {15, 9, 3},
- {16, 15, 4},
- {17, 20, 5}
- };
- main()
- {
- new BestRoad = GetRoadPoints(5, 6, 1);
- printf("O ponto mais próximo de 5, 6, 1 é %d %d %d", iRoads[BestRoad][0],iRoads[BestRoad][1],iRoads[BestRoad][2]);
- }
- GetRoadPoints(xRoad, yRoad,zRoad)
- {
- new
- RoadPoint = 0,
- RoadLow = iMaxRoadPoint;
- for(new i = 0; i != iMaxRoadings; i++) {
- new
- RoadValue = floatround(floatsqroot(floatpower(floatsub(iRoads[i][0], xRoad), 2) + floatpower(floatsub( iRoads[i][1], yRoad), 2) + floatpower(floatsub( iRoads[i][2], zRoad), 2)));
- if(RoadValue < RoadLow) {
- RoadLow = RoadValue;
- RoadPoint = i;
- }
- }
- return RoadPoint;
- }
- // Por Bruno da Silva
- // www.ips-team.blogspot.com
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement