Jump to content

Check zone


Hugos

Recommended Posts

Hi everyone! I created an array in which I pointed out street names. For example, Los Santos array: local location_ls = {"Vinewood," Marina, "Mulholland,"...}
I need to perform one function when the player is in Los Santos. How can this be done?

Link to comment
  • Moderators
Just now, Hugos said:

Ok. Thanks you!

Something like this

 

local location_ls = {"Vinewood", "Marina", "Mulholland"}

function isPlayerInSpecifiedZone(player)
    local x, y, z = getElementPosition(player)
    local zoneName = getZoneName(x, y, z)
  
    for _, v in ipairs(location_ls) do
        if v == zoneName then
            return true
        end
    end
    return false
end

 

  • Thanks 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...