Jump to content

Table is nill


JuniorMelo

Recommended Posts

Posted (edited)

hello, I have a bug in this function, not creating this marker in the city that the player is.

Citys = {} 
  
markerPizza = createMarker( 2485.0024414063, 2022.3449707031, 9.8203125, "cylinder", 1.5, 255, 180, 0, 100) 
blipPizza = createBlipAttachedTo( markerPizza, 14, 2, 255, 255, 0, 255 ) 
  
  
Citys["Los Santos"] = { 
    {x=2382.4638671875, y=-1891.9400634766, z=13.38914680481}, 
} 
  
Citys["San Fierro"] = { 
    {x=-2686.283203125, y=270.83374023438, z=4.3359375}, 
} 
  
  
Citys["Las Venturas"] = { 
    {x=2445.8454589844, y=2020.6320800781, z=10.8203125}, 
} 
  
function onPizzaMarkerHit(hitPlayer) 
    Citys[i] = { x=x, y=y, z=z } 
    local xx, yy, zz = getElementPosition ( localPlayer ) 
    local city = getZoneName(xx, yy, zz, true) 
    local x, y, z = Citys[city].x, Citys[city].y, Citys[city].z 
    local marker = createMarker(x, y, z, "cylinder", 2, 255, 188, 0) 
    local blip = createBlip(x, y, z, 24, 1) 
    if isElement(markerPizza) then destroyElement(markerPizza) end 
    if isElement(blipPizza) then destroyElement(blipPizza) end 
    addEventHandler("onClientMarkerHit", marker, 
    function() 
    fadeCamera(false) 
    setTimer(fadeCamera, 2000, 1, true) 
    triggerServerEvent("EndJob", localPlayer, localPlayer, elements) 
    end) 
end 
addEventHandler("onClientMarkerHit", markerPizza, onPizzaMarkerHit) 
  

5xWaLgE.png

Edited by Guest

........... \__ ▄▂_

.........[█|||███████]▄▄▄▄▄▄▄▄▄▃▂

..__▂▄▅█████████▅▄▃▂

I███████████████████]

...◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤

░░░███████ ]▄▄▄▄▄▄▄▄

▂▄▅████████▅▄▃▂

I███████████████████]

◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤

Posted
Citys = {} 
  
markerPizza = createMarker( 2485.0024414063, 2022.3449707031, 9.8203125, "cylinder", 1.5, 255, 180, 0, 100) 
blipPizza = createBlipAttachedTo( markerPizza, 14, 2, 255, 255, 0, 255 ) 
  
  
Citys["Los Santos"] = { 
    {x=2382.4638671875, y=-1891.9400634766, z=13.38914680481}, 
} 
  
Citys["San Fierro"] = { 
    {x=-2686.283203125, y=270.83374023438, z=4.3359375}, 
} 
  
  
Citys["Las Venturas"] = { 
    {x=2445.8454589844, y=2020.6320800781, z=10.8203125}, 
} 
  
function onPizzaMarkerHit(hitPlayer) 
    local xx, yy, zz = getElementPosition ( localPlayer ) 
    local city = getZoneName(xx, yy, zz, true) 
    local x, y, z = Citys[city].x, Cityw[city].y, Citys[city].z 
    local marker = createMarker(x, y, z, "cylinder", 2, 255, 188, 0) 
    local blip = createBlip(x, y, z, 24, 1) 
    if isElement(markerPizza) then destroyElement(markerPizza) end 
    if isElement(blipPizza) then destroyElement(blipPizza) end 
    addEventHandler("onClientMarkerHit", marker, 
    function() 
    fadeCamera(false) 
    setTimer(fadeCamera, 2000, 1, true) 
    triggerServerEvent("EndJob", localPlayer, localPlayer, elements) 
    end) 
end 
addEventHandler("onClientMarkerHit", markerPizza, onPizzaMarkerHit) 
  

Posted
Citys = {} 
  
markerPizza = createMarker( 2485.0024414063, 2022.3449707031, 9.8203125, "cylinder", 1.5, 255, 180, 0, 100) 
blipPizza = createBlipAttachedTo( markerPizza, 14, 2, 255, 255, 0, 255 ) 
  
  
Citys["Los Santos"] = { 
    {x=2382.4638671875, y=-1891.9400634766, z=13.38914680481}, 
} 
  
Citys["San Fierro"] = { 
    {x=-2686.283203125, y=270.83374023438, z=4.3359375}, 
} 
  
  
Citys["Las Venturas"] = { 
    {x=2445.8454589844, y=2020.6320800781, z=10.8203125}, 
} 
  
function onPizzaMarkerHit(hitPlayer) 
    local xx, yy, zz = getElementPosition ( localPlayer ) 
    local city = getZoneName(xx, yy, zz, true) 
    local x, y, z = Citys[city].x, Cityw[city].y, Citys[city].z 
    local marker = createMarker(x, y, z, "cylinder", 2, 255, 188, 0) 
    local blip = createBlip(x, y, z, 24, 1) 
    if isElement(markerPizza) then destroyElement(markerPizza) end 
    if isElement(blipPizza) then destroyElement(blipPizza) end 
    addEventHandler("onClientMarkerHit", marker, 
    function() 
    fadeCamera(false) 
    setTimer(fadeCamera, 2000, 1, true) 
    triggerServerEvent("EndJob", localPlayer, localPlayer, elements) 
    end) 
end 
addEventHandler("onClientMarkerHit", markerPizza, onPizzaMarkerHit) 
  

uK05jbC.png

........... \__ ▄▂_

.........[█|||███████]▄▄▄▄▄▄▄▄▄▃▂

..__▂▄▅█████████▅▄▃▂

I███████████████████]

...◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤

░░░███████ ]▄▄▄▄▄▄▄▄

▂▄▅████████▅▄▃▂

I███████████████████]

◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤

Posted

It works this way. thx thx 8)

local ran = math.random(#Citys[city]) 
 local x, y, z = Citys[city][ran].x, Citys[city][ran].y, Citys[city][ran].z 

........... \__ ▄▂_

.........[█|||███████]▄▄▄▄▄▄▄▄▄▃▂

..__▂▄▅█████████▅▄▃▂

I███████████████████]

...◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤

░░░███████ ]▄▄▄▄▄▄▄▄

▂▄▅████████▅▄▃▂

I███████████████████]

◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤

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