Jump to content

Coordinated by region


TIGS98

Recommended Posts

I need help with the coordinate of the locs.

I'm trying to detect the player's region and define a coordinate for the region "locs" I'm not getting more, if anyone can help ..

  
local locs = nil 
  
local e = { ['blip'] = { }, ['marker'] = { } } 
  
addEvent ( "onPlayerStartArrested", true ) 
addEventHandler ( "onPlayerStartArrested", root, function ( p, c) 
    if ( c == localPlayer ) then 
            local x, y, z = getElementPosition ( localPlayer ) 
            local city = getZoneName ( x, y, z, true ) 
        if city == "Los Santos" then 
            locs = {  { 1565.48, -1694.23, 5.89 } } 
        elseif city == "San Fierro" then 
            locs = {  { -1560.33, 661.19, 7.04 } } 
        elseif city == "Las Venturas" then 
            locs = {  { 2292.11, 2451.46, 10.82 } } 
        end 
        for i, v in ipairs ( locs ) do 
            local x, y, z = unpack ( v ) 
            e['marker'][i] = createMarker ( x, y, z - 1, "cylinder", 2.5, 0, 120, 255, 120 ) 
            e['blip'][i] = createBlip ( x, y,z, 30 )  
            addEventHandler ( "onClientMarkerHit", e['marker'][i], function ( p ) 
                if ( p == localPlayer ) then 
                    for i, v in pairs ( e ) do  
                        for i, v in pairs ( v ) do  
                            if ( isElement ( v ) ) then 
                                destroyElement ( v ) 
                            end 
                        end 
                    end  
                    triggerServerEvent ( "sistemapolice:colocaojogadornacadeia", localPlayer ) 
                end 
            end ) 
        end 
    end 
end ) 

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...