Sexying the code
This commit is contained in:
parent
406d705ae1
commit
a15fa28382
@ -205,8 +205,8 @@ CMD:gps( playerid, params[ ] )
|
|||||||
SendServerMessage( playerid, ""COL_GREY"[GPS]"COL_WHITE" You have set your destination to closest atm." );
|
SendServerMessage( playerid, ""COL_GREY"[GPS]"COL_WHITE" You have set your destination to closest atm." );
|
||||||
}
|
}
|
||||||
else if( !strcmp( params, "vehicle", false, 7 ) ){
|
else if( !strcmp( params, "vehicle", false, 7 ) ){
|
||||||
new vehName[24];
|
new vehName[ 24 ];
|
||||||
if ( sscanf( params[ 8 ], "s[24]", vehName ) ) return SendUsage( playerid, "/gps vehicle [NAME]" );
|
if ( sscanf( params[ 8 ], "s[ 24 ]", vehName ) ) return SendUsage( playerid, "/gps vehicle [NAME]" );
|
||||||
|
|
||||||
new Float: vXp, Float: vYp, Float: vZp, vehID = GetVehicleModelFromName( vehName );
|
new Float: vXp, Float: vYp, Float: vZp, vehID = GetVehicleModelFromName( vehName );
|
||||||
|
|
||||||
@ -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;
|
||||||
for(new i = 0; i < MAX_VEHICLES; i++){
|
|
||||||
if( GetVehicleModel(i) == id ){
|
|
||||||
GetPlayerPos( playerid, pX, pY, pZ );
|
GetPlayerPos( playerid, pX, pY, pZ );
|
||||||
|
for ( new i = 0; i < MAX_VEHICLES; i++ ) {
|
||||||
|
if( GetVehicleModel( i ) == id ) {
|
||||||
distance = GetVehicleDistanceFromPoint( i, pX, pY, pZ );
|
distance = GetVehicleDistanceFromPoint( i, pX, pY, pZ );
|
||||||
if( closestDist > distance ){
|
if( closestDist > distance ){
|
||||||
closestDist = distance;
|
closestDist = distance;
|
||||||
|
@ -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;
|
||||||
for(new i = 0; i < MAX_ATMS; i++){
|
|
||||||
GetATMPos( i, oX, oY, oZ );
|
|
||||||
GetPlayerPos( playerid, pX, pY, pZ );
|
GetPlayerPos( playerid, pX, pY, pZ );
|
||||||
distance = floatsqroot( ( (pX - oX) * (pX - oX) ) + ( (pY - oY) * (pY - oY) + ( (pZ - oZ) * (pZ - oZ) ) ) );
|
for( new i = 0; i < MAX_ATMS; i++ ){
|
||||||
|
GetATMPos( i, oX, oY, oZ );
|
||||||
|
distance = VectorSize( pX-oX, pY-oY, pZ-oZ );
|
||||||
if( closestDist > distance ){
|
if( closestDist > distance ){
|
||||||
closestDist = distance;
|
closestDist = distance;
|
||||||
closest = i;
|
closest = i;
|
||||||
|
Loading…
Reference in New Issue
Block a user