Starztec Posted September 12, 2017 Posted September 12, 2017 local veh = getPedOccupiedVehicle(localPlayer) speedx, speedy, speedz = getElementVelocity ( veh ) actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kmh = actualspeed * 180 function Inicio (element) if element == localPlayer then if (kmh) <= 20 then --Si es menor o igual a 20Km/h if veh then setElementFrozen ( veh, true ) --freez if timer then killTimer(timer) timer = nil end timer = setTimer(SiguienteMarker, 3000, 1) --Que freeze, espere 3 segundos y siga el otro marker end end end El problema es que no funciona el "If (kmh) <= 20 then, al poner eso directamente me deja de funcionar todo, alguien sabe porqué? Lo que quiero es que solo se active cuando el jugador Toque el marker y a menos de 20km/h con su vehiculo y recien ahi freeze al jugador y cuente para luego crear otro marker..
Simple0x47 Posted September 12, 2017 Posted September 12, 2017 4 hours ago, Starztec said: local veh = getPedOccupiedVehicle(localPlayer) speedx, speedy, speedz = getElementVelocity ( veh ) actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kmh = actualspeed * 180 function Inicio (element) if element == localPlayer then if (kmh) <= 20 then --Si es menor o igual a 20Km/h if veh then setElementFrozen ( veh, true ) --freez if timer then killTimer(timer) timer = nil end timer = setTimer(SiguienteMarker, 3000, 1) --Que freeze, espere 3 segundos y siga el otro marker end end end El problema es que no funciona el "If (kmh) <= 20 then, al poner eso directamente me deja de funcionar todo, alguien sabe porqué? Lo que quiero es que solo se active cuando el jugador Toque el marker y a menos de 20km/h con su vehiculo y recien ahi freeze al jugador y cuente para luego crear otro marker.. La cosa es que te falta un end. local veh = getPedOccupiedVehicle(localPlayer) speedx, speedy, speedz = getElementVelocity ( veh ) actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kmh = actualspeed * 180 function Inicio (element) if element == localPlayer then if (kmh) <= 20 then --Si es menor o igual a 20Km/h if veh then setElementFrozen ( veh, true ) --freez if timer then killTimer(timer) timer = nil end timer = setTimer(SiguienteMarker, 3000, 1) --Que freeze, espere 3 segundos y siga el otro marker end end end end 2 1
Starztec Posted September 12, 2017 Author Posted September 12, 2017 1 hour ago, Uknown. said: La cosa es que te falta un end. local veh = getPedOccupiedVehicle(localPlayer) speedx, speedy, speedz = getElementVelocity ( veh ) actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kmh = actualspeed * 180 function Inicio (element) if element == localPlayer then if (kmh) <= 20 then --Si es menor o igual a 20Km/h if veh then setElementFrozen ( veh, true ) --freez if timer then killTimer(timer) timer = nil end timer = setTimer(SiguienteMarker, 3000, 1) --Que freeze, espere 3 segundos y siga el otro marker end end end end Es por las idas y vueltas antes de publicarlo, pero no es eso, sigue sin funcionar, me freeze a cualquier velocidad, como si no existiese tal condición
alex17" Posted September 13, 2017 Posted September 13, 2017 49 minutes ago, Starztec said: Es por las idas y vueltas antes de publicarlo, pero no es eso, sigue sin funcionar, me freeze a cualquier velocidad, como si no existiese tal condición es por que estas tomando la velocidad al iniciar el resource debes acomodar la parte donde tomas la velocidad en tu función donde freezeas el vehiculo 2
Starztec Posted September 13, 2017 Author Posted September 13, 2017 2 hours ago, alex17" said: es por que estas tomando la velocidad al iniciar el resource debes acomodar la parte donde tomas la velocidad en tu función donde freezeas el vehiculo Toda la razón, Solucionado; Gracias a todos los que me ayudaron!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now