Jump to content

Bad Argument? Ayuda.


Araa

Recommended Posts

Tengo un problema en mi script, el blip y el marker se crean cuando entro al vehiculo, pero cuando le doy hit a un marker me dice Bad Argument @getElementModel .

Intente mucho pero no lo puedo arreglar, alguna idea del porque? :/

function getNewLocation(player, seat) 
        local vehicle = getPedOccupiedVehicle(player) 
        local id = getElementModel(vehicle) 
        if ( id == 448 ) and ( seat == 0 )then 
            outputChatBox("A new location has been marker in your map, deliver you pizza on time!") 
            num = math.random(#markersPosition) 
            marker = createMarker(markersPosition[num][1], markersPosition[num][2], markersPosition[num][3], "checkpoint", 1.5, 100, 150, 50) 
            blip = createBlipAttachedTo(marker, 51) 
            addEventHandler("onClientMarkerHit", marker,                   
                function() 
                    destroyElement(marker) 
                    destroyElement(blip) 
                    setTimer(getNewLocation,2000,1) 
                end) 
        end 
end 
addEventHandler("onClientVehicleEnter", root, getNewLocation) 

Gracias.

Link to comment
function getNewLocation ( player, seat ) 
    local vehicle = getPedOccupiedVehicle ( player ) 
    local id = getElementModel ( vehicle ) 
    if ( id == 448 ) and ( seat == 0 )then 
        outputChatBox ( "A new location has been marker in your map, deliver you pizza on time!" ) 
        local num = math.random ( #markersPosition ) 
        marker = createMarker ( markersPosition [ num ] [ 1 ], markersPosition [ num ] [ 2 ], markersPosition [ num ] [ 3 ], "checkpoint", 1.5, 100, 150, 50 ) 
        blip = createBlipAttachedTo ( marker, 51 ) 
        addEventHandler ( "onClientMarkerHit", marker,                   
            function ( hitElement ) 
                if ( hitElement and getElementType ( hitElement ) == "player" and hitElement == localPlayer ) then 
                    destroyElement ( marker ) 
                    destroyElement ( blip ) 
                    setTimer ( getNewLocation, 2000, 1, localPlayer, seat ) 
                end 
            end 
        ) 
    end 
end 
addEventHandler ( "onClientVehicleEnter", root, getNewLocation ) 

Proba con eso.

Link to comment
  • Recently Browsing   0 members

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