Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Support [Server] How to check if you have a vehicle in position

 
  • 0 Vote(s) - 0 Average
Server How to check if you have a vehicle in position
Frajola
Offline

Burgershot Member
Posts: 12
Threads: 6
Joined: Apr 2019
Reputation: 0
Location: Rio de Janeiro
#1
2020-12-09, 01:37 AM (This post was last modified: 2020-12-09, 05:53 AM by Frajola.)
Hello guys, I have a problem. I'm making a garage system and I would like to know if there are any vehicles parked.


I tried that way, but the vehicle is created in the same position in the second wave, the system works perfectly until the second wave, the third time the truck is created on top of the other.

My English is bad, for a better interpretation of the problem, watch the video: https://youtu.be/QOKytHFMVQQ
Code:
enum VacancyInfo
{
    Float:posX,
    Float:posY,
    Float:posZ,
    Float:posA
}
new TruckerVacancy[MAX_TRUCKER_VACANCY][VacancyInfo] =
{
    {2788.3999000,-2484.7000000,14.8000000,90.0000000},
    {2788.3999000,-2474.3999000,14.8000000,90.0000000},
    {2788.3999000,-2464.1001000,14.8000000,90.0000000},
    {2788.3999000,-2453.8000000,14.8000000,90.0000000},
    {2788.3999000,-2443.5000000,14.8000000,90.0000000},
    {2788.3999000,-2433.2000000,14.8000000,90.0000000},
    {2788.3999000,-2422.8999000,14.8000000,90.0000000}
};

#define IsVehicleInRangeOfPoint(%0,%1,%2,%3,%4)\
    (%1 >= GetVehicleDistanceFromPoint(%0, %2, %3, %4))

stock IsVehicleFromRangePointEx(Float:range, Float:x, Float:y, Float:z)
{
    foreach(new i: Vehicle)
    {
        return IsVehicleInRangeOfPoint(i, range, x, y, z);
    }
    return 0;
}

CMD:etruck(playerid, params[])
{
    for(new i; i < MAX_TRUCKER_VACANCY; i++)
    {
        if(!IsVehicleFromRangePointEx(5.0, TruckerVacancy[i][posX],TruckerVacancy[i][posY],TruckerVacancy[i][posZ]))
        {
            CreateVehicleEx(403, TruckerVacancy[i][posX],TruckerVacancy[i][posY],TruckerVacancy[i][posZ],TruckerVacancy[i][posA], 0, 0);
            return 1;
        }
    }
    return 1;
}
« Next Oldest | Next Newest »



Messages In This Thread
How to check if you have a vehicle in position - by Frajola - 2020-12-09, 01:37 AM
RE: How to check if you have a vehicle in position - by Radical - 2020-12-09, 08:33 PM
RE: How to check if you have a vehicle in position - by Frajola - 2020-12-09, 09:24 PM
RE: How to check if you have a vehicle in position - by Pinch - 2020-12-10, 11:13 AM

  • 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