• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Script is taking opposite value.
#1
Hi again,

When I tried to get the nearest unlocked house, it shows unknown command but when I closed the house, it does work but it was opposite of what I want.

Command I make to test the system
PHP Code:
COMMAND:testhouse(playeridparams[])
{
? ? 
//GetClosestHouse
? ? new iClosest GetClosestHouse(playerid);
SetPlayerCheckpoint(playeridHouse[iClosest][House_x], House[iClosest][House_y], House[iClosest][House_z], 3.0);
SendClientInfo(playerid"Marker set to the closest house.");
return 
1;


Function
PHP Code:
stock GetClosestHouse(playerid)
{
new
? ? 
cl_ID = -1,
Float:cl_DIST 9999.0;

for(new 
i=1l=MAX_HOUSES!= li)
{
? ? if(
House[i][locked] != 1) continue;
if( 
GetPlayerDistanceToPointEx(playeridHouse[i][House_x],? House[i][House_y], House[i][House_z]) < cl_DIST )
{
? ? 
cl_ID i;
? ? 
cl_DIST GetPlayerDistanceToPointEx(playeridHouse[i][House_x],House[i][House_y],House[i][House_z]);
}
}
return 
cl_ID;

  Reply
#2
fixed
  Reply


Forum Jump: