Jump to content

setVehicleLocked(Duda con esto)


#Dv^

Recommended Posts

Hola!
Disculpen, tengo este script de la comunidad

 

function announceCommands(nick,ip,username,serial,version)
    bindKey(getPlayerFromName(nick),"","down","lock","")
end

addEventHandler("onPlayerConnect",getRootElement(),announceCommands)

function lockCommand(thePlayer,command)
    local playerVehicle = getPedOccupiedVehicle(thePlayer)
    if playerVehicle then
        local vehicleType = getVehicleType(playerVehicle)
        if isVehicleLockable(playerVehicle) == true then
            local lockedState = isVehicleLocked(playerVehicle)
            setVehicleLocked(playerVehicle,not lockedState)
            if lockedState == true then 
                showTextDisplay(thePlayer,"Tu carro está desbloqueado.")
            elseif lockedState == false then 
                showTextDisplay(thePlayer,"Tu carro está bloqueado.")
            end
        else
        showTextDisplay(thePlayer,"Este vehículo ("..getVehicleName(playerVehicle)..") no se puede bloquear.")
        end
    else
    showTextDisplay(thePlayer,"No estás en un vehículo!")
    end
end
addCommandHandler("lock",lockCommand,false,false)

function showTextDisplay(player,...)
outputChatBox(table.concat(arg," "),player,0,255,0,true)
end
function isVehicleLockable (vehicle)
    local notLockableVehicles = {501}
    -- Table for not lockable vehicles, 100% from me :D
    -- Maybe I missed some vehicles, feel free to edit it.
    local itsLockable = true -- At start, the vehicle is lockable.
    local myVehicle = getElementModel(vehicle) -- Get the model ID of the vehicle to work with it.
    for k, notLockableVehicle in pairs(notLockableVehicles) do -- Do for every notlockable vehicles
        if myVehicle == notLockableVehicle then -- If the vehicle inputted is a not lockable vehicle
            itsLockable = false -- Then its not lockable
            return false -- So return false, it isn't lockable
        end
    end
    if itsLockable == true then -- If we didn't set it to false before, then its lockable,
        return true -- So return true.
    end
    -- By Stryp
end

Mi pregunta es si puedo desbloquear el vehículo estando fuera de él, por que este me pide que este dentro de un auto para bloquearlo o desbloquearlo, y si lo bloqueo después no puedo ingresar al mismo por que me pide desbloquearlo pero estando en un auto, ¿Podrían indicarme que debo usar?
Agradezco su respuesta

Edited by Slash14
Link to comment
  • Recently Browsing   0 members

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