Jump to content

Now I would like it to also block the door and I don't know how to do it


Recommended Posts

elseif itemActioned == "llavesauto" and getElementType(clickedWorld) == "vehicle" then
		if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then
			if not isPedInVehicle(playerSource) then
			local veiculo = getElementData(playerSource, "Vehicle:Owner")
				if not isTimer(acao[playerSource]) then
					local x, y, z = getElementPosition(playerSource)
					local ex, ey, ez = getElementPosition(clickedWorld)
					if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 2.5 then
						local counter = 0
						for seat, player in pairs(getVehicleOccupants(clickedWorld)) do
    						counter = counter + 1
						end
						if counter < 1 then
							if getElementData(clickedWorld, "Locked") then
								acao[playerSource] = setTimer(function() end, 9, 1)
								PlaySound3D(playerSource, "vehicle-alarm2", "all")
								--GiveAndTakeAndGetItem("take", playerSource, itemActioned, 1)
								
								 --recuerda poner la alarma 
								--setElementFrozen(playerSource, true)
								--setElementFrozen(clickedWorld, true)
								--setPedAnimation(playerSource, "CAMERA", "piccrch_take", 90000, true, false, false, false, _, true)
								--triggerClientEvent(playerSource, "progressBar", playerSource, 90000)
								--blip[clickedWorld] = createBlipAttachedTo(clickedWorld, 36)
								--setElementVisibleTo(blip[clickedWorld], root, false)
								for _, players in pairs(getElementsByType("player")) do
									--if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(players)), aclGetGroup(ACL_VEH)) then
										--exports._infobox:addNotification(players, "[ESTACIÓN]: Reporte de robo de vehículo en curso, el lugar de ocurrencia fue indicado en su GPS", "warning")
										--setElementVisibleTo(blip[clickedWorld], players, true)
									end
								
								--setTimer(function()
									--setPedAnimation(playerSource, nil)
									--setElementFrozen(playerSource, false)
									--setElementFrozen(clickedWorld, false)
									--destroyElement(blip[clickedWorld])
									--blip[clickedWorld] = nil
									local random = math.random(1)
									if random == 1 then
										setElementData(clickedWorld, "Locked", false) 
										setVehicleLocked(clickedWorld, false)
										exports._infobox:addNotification(playerSource, "Vehiculo Desbloqueado", "success")
										local name = getPlayerName(playerSource)
										local ID1 = getElementData(playerSource, "ID") or "N/A"
										local model = getElementModel(clickedWorld)
										exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nDueño: "..name.." ["..ID1.."]\nVehiculo: "..model)
									else
										exports._infobox:addNotification(playerSource, "Has quitado el seguro a tu vehiculo", "error")
									end
								
							else
								exports._infobox:addNotification(playerSource, "Este vehiculo ya esta desbloqueado", "error")
							end
						else
							exports._infobox:addNotification(playerSource, "El vehiculo requiere estar vacio para poder abrirlo", "error")
						end
					else
						exports._infobox:addNotification(playerSource, "Estas muy lejos del vehiculo", "error")
					end
				end
			else
				exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para usar '"..realName[itemActioned][1].."'", "error")
			end
		else
			exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error")
			end

I managed to put together this script, surely it has its errors, I am learning a bit clumsy, I would like it to have the function of sonar vehicle-alarm2 to block but I have not been able to do it
 

Link to comment

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