Jump to content

Bad Argument? Ayuda.


Araa

Recommended Posts

Posted

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.

Hi, this is a signature.

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

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Oh, no me di cuenta de que esa funcion es solo server side, copia el codigo de nuevo y proba.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Oh, no me di cuenta de que esa funcion es solo server side, copia el codigo de nuevo y proba.

aun: badArgument @getElementModel

Hi, this is a signature.

Posted

Ah, es que puse 'source' en vez de 'vehicle', copialo de nuevo :P.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Ah, es que puse 'source' en vez de 'vehicle', copialo de nuevo :P.

Funciono, muchas gracias :)

Hi, this is a signature.

Posted

No hay de que :).

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

  • Recently Browsing   0 members

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