Sexying the code

This commit is contained in:
Crova 2019-02-03 10:25:33 +01:00
parent 406d705ae1
commit a15fa28382
2 changed files with 9 additions and 9 deletions

View File

@ -216,7 +216,7 @@ CMD:gps( playerid, params[ ] )
SendClientMessageFormatted( playerid, -1, ""COL_GREY"[GPS]"COL_WHITE" You have set your destination to closest %s", GetVehicleName( vehID ) ); SendClientMessageFormatted( playerid, -1, ""COL_GREY"[GPS]"COL_WHITE" You have set your destination to closest %s", GetVehicleName( vehID ) );
GPS_SetPlayerWaypoint( playerid, "Closest vehicle (model)", vXp, vYp, vZp ); GPS_SetPlayerWaypoint( playerid, sprintf( "Closest vehicle: %s", GetVehicleName( vehID ) ), vXp, vYp, vZp );
} }
else else
{ {
@ -307,9 +307,9 @@ function GPS_Update( playerid, Float: destX, Float: destY, Float: destZ )
stock GetClosestVehicleModel( playerid, id ){ stock GetClosestVehicleModel( playerid, id ){
new closest = -1, Float: closestDist = 8000.00, Float: distance, Float: pX, Float: pY, Float: pZ; new closest = -1, Float: closestDist = 8000.00, Float: distance, Float: pX, Float: pY, Float: pZ;
GetPlayerPos( playerid, pX, pY, pZ );
for ( new i = 0; i < MAX_VEHICLES; i++ ) { for ( new i = 0; i < MAX_VEHICLES; i++ ) {
if( GetVehicleModel( i ) == id ) { if( GetVehicleModel( i ) == id ) {
GetPlayerPos( playerid, pX, pY, pZ );
distance = GetVehicleDistanceFromPoint( i, pX, pY, pZ ); distance = GetVehicleDistanceFromPoint( i, pX, pY, pZ );
if( closestDist > distance ){ if( closestDist > distance ){
closestDist = distance; closestDist = distance;

View File

@ -242,10 +242,10 @@ stock CreateATM( Float: X, Float: Y, Float: Z, Float: rX, Float: offset = 180.0,
stock GetClosestATM( playerid ){ stock GetClosestATM( playerid ){
new closest = -1, Float: closestDist = 8000.00, Float: distance, Float: pX, Float: pY, Float: pZ, Float: oX, Float: oY, Float: oZ; new closest = -1, Float: closestDist = 8000.00, Float: distance, Float: pX, Float: pY, Float: pZ, Float: oX, Float: oY, Float: oZ;
GetPlayerPos( playerid, pX, pY, pZ );
for( new i = 0; i < MAX_ATMS; i++ ){ for( new i = 0; i < MAX_ATMS; i++ ){
GetATMPos( i, oX, oY, oZ ); GetATMPos( i, oX, oY, oZ );
GetPlayerPos( playerid, pX, pY, pZ ); distance = VectorSize( pX-oX, pY-oY, pZ-oZ );
distance = floatsqroot( ( (pX - oX) * (pX - oX) ) + ( (pY - oY) * (pY - oY) + ( (pZ - oZ) * (pZ - oZ) ) ) );
if( closestDist > distance ){ if( closestDist > distance ){
closestDist = distance; closestDist = distance;
closest = i; closest = i;