Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Pawn Scripting [Pawn] Script is taking opposite value.

 
  • 0 Vote(s) - 0 Average
Pawn Script is taking opposite value.
Axitz
Offline

Burgershot Member
Posts: 24
Threads: 11
Joined: Apr 2021
Reputation: 0
Location: Malaysia
#1
2021-04-05, 01:23 PM (This post was last modified: 2021-04-05, 01:36 PM by Axitz.)
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(playerid, params[])
{
    //GetClosestHouse
    new iClosest = GetClosestHouse(playerid);
SetPlayerCheckpoint(playerid, House[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=1, l=MAX_HOUSES; i != l; i++)
{
    if(House[i][locked] != 1) continue;
if( 
GetPlayerDistanceToPointEx(playerid, House[i][House_x],  House[i][House_y], House[i][House_z]) < cl_DIST )
{
    cl_ID = i;
    cl_DIST = GetPlayerDistanceToPointEx(playerid, House[i][House_x],House[i][House_y],House[i][House_z]);
}
}
return 
cl_ID;
} 
Axitz
Offline

Burgershot Member
Posts: 24
Threads: 11
Joined: Apr 2021
Reputation: 0
Location: Malaysia
#2
2021-04-05, 06:06 PM
fixed
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode