#Dv^ Posted October 23, 2016 Share Posted October 23, 2016 (edited) 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 October 23, 2016 by Slash14 Link to comment
Simple0x47 Posted October 23, 2016 Share Posted October 23, 2016 Necesitarias almacenar algun dato en una tabla para diferenciar el vehículo que es el del jugador para cerrarlo desde fuera. Link to comment
#Dv^ Posted October 24, 2016 Author Share Posted October 24, 2016 Gracias por tu ayuda, ya pude hacer que funcione Link to comment
Recommended Posts